KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pdf_outline_font.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
21#include <trace_helpers.h>
22#include <wx/log.h>
23#include <cstdlib>
24
25#include <algorithm>
26#include <cctype>
27#include <limits>
28#include <cmath>
29
30#include <fmt/format.h>
31#include <harfbuzz/hb-ft.h>
32#include <harfbuzz/hb.h>
33#include <wx/ffile.h>
34
35#include <core/utf8.h>
36
37#include <ft2build.h>
38#include FT_FREETYPE_H
39
40#include <font/font.h>
41
42namespace
43{
44std::string formatUnicodeHex( uint32_t aCodepoint )
45{
46 if( aCodepoint <= 0xFFFF )
47 return fmt::format( "{:04X}", aCodepoint );
48
49 if( aCodepoint <= 0x10FFFF )
50 {
51 uint32_t value = aCodepoint - 0x10000;
52 uint16_t high = 0xD800 + ( value >> 10 );
53 uint16_t low = 0xDC00 + ( value & 0x3FF );
54 return fmt::format( "{:04X}{:04X}", high, low );
55 }
56
57 return std::string( "003F" );
58}
59
60std::u32string utf8ToU32( const std::string& aUtf8 )
61{
62 std::u32string result;
63 UTF8 utf8( aUtf8.c_str() );
64
65 for( auto it = utf8.ubegin(); it < utf8.uend(); ++it )
66 result.push_back( static_cast<uint32_t>( *it ) );
67
68 return result;
69}
70
71std::string generateSubsetPrefix( unsigned aSubsetIndex )
72{
73 static constexpr char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
74 std::string prefix( 6, 'A' );
75
76 for( int ii = 5; ii >= 0; --ii )
77 {
78 prefix[ii] = letters[ aSubsetIndex % 26 ];
79 aSubsetIndex /= 26;
80 }
81
82 return prefix;
83}
84
85double unitsToPdf( double aValue, double aUnitsPerEm )
86{
87 if( aUnitsPerEm == 0.0 )
88 return 0.0;
89
90 return aValue * 1000.0 / aUnitsPerEm;
91}
92}
93
95{
96 if( m_glyphIndex != aOther.m_glyphIndex )
97 return m_glyphIndex < aOther.m_glyphIndex;
98
99 return m_unicode < aOther.m_unicode;
100}
101
103 m_font( aFont ),
104 m_resourceName( makeResourceName( aSubsetIndex ) ),
105 m_baseFontName( makeSubsetName( aFont, aSubsetIndex ) ),
106 m_unitsPerEm( 1000.0 ),
107 m_ascent( 0.0 ),
108 m_descent( 0.0 ),
109 m_capHeight( 0.0 ),
110 m_italicAngle( 0.0 ),
111 m_stemV( 80.0 ),
112 m_bboxMinX( 0.0 ),
113 m_bboxMinY( 0.0 ),
114 m_bboxMaxX( 0.0 ),
115 m_bboxMaxY( 0.0 ),
116 m_flags( 32 ),
117 m_fontDataLoaded( false ),
118 m_nextCID( 1 ),
119 m_fontFileHandle( -1 ),
121 m_cidFontHandle( -1 ),
122 m_cidMapHandle( -1 ),
123 m_toUnicodeHandle( -1 ),
124 m_fontHandle( -1 )
125{
126 FT_Face face = aFont ? aFont->GetFace() : nullptr;
127
128 if( face )
129 {
130 if( face->units_per_EM > 0 )
131 m_unitsPerEm = static_cast<double>( face->units_per_EM );
132
133 m_ascent = unitsToPdf( static_cast<double>( face->ascender ), m_unitsPerEm );
134 m_descent = unitsToPdf( static_cast<double>( face->descender ), m_unitsPerEm );
135 m_capHeight = unitsToPdf( static_cast<double>( face->bbox.yMax ), m_unitsPerEm );
136 m_bboxMinX = unitsToPdf( static_cast<double>( face->bbox.xMin ), m_unitsPerEm );
137 m_bboxMinY = unitsToPdf( static_cast<double>( face->bbox.yMin ), m_unitsPerEm );
138 m_bboxMaxX = unitsToPdf( static_cast<double>( face->bbox.xMax ), m_unitsPerEm );
139 m_bboxMaxY = unitsToPdf( static_cast<double>( face->bbox.yMax ), m_unitsPerEm );
140
141 if( face->style_flags & FT_STYLE_FLAG_ITALIC )
142 m_italicAngle = -12.0;
143 else if( aFont->IsItalic() )
144 m_italicAngle = -12.0;
145
146 if( aFont->IsBold() )
147 m_stemV = 140.0;
148
149 if( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
150 m_flags |= 1;
151
152 if( aFont->IsItalic() )
153 m_flags |= 64;
154 }
155
156 m_widths.resize( 1, 0.0 );
157 m_cidToGid.resize( 1, 0 );
158 m_cidToUnicode.resize( 1 );
159}
160
162{
163 return m_nextCID > 1;
164}
165
167{
168 if( m_widths.empty() )
169 {
170 m_widths.resize( 1, 0.0 );
171 m_cidToGid.resize( 1, 0 );
172 m_cidToUnicode.resize( 1 );
173 }
174}
175
176uint16_t PDF_OUTLINE_FONT_SUBSET::EnsureGlyph( uint32_t aGlyphIndex, const std::u32string& aUnicode )
177{
178 if( aGlyphIndex == 0 )
179 return 0;
180
181 GLYPH_KEY key{ aGlyphIndex, aUnicode };
182
183 auto it = m_glyphMap.find( key );
184
185 if( it != m_glyphMap.end() )
186 return it->second;
187
188 ensureNotdef();
189
190 FT_Face face = m_font ? m_font->GetFace() : nullptr;
191
192 if( !face )
193 return 0;
194
195 if( FT_Load_Glyph( face, aGlyphIndex, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) )
196 return 0;
197
198 // For FT_LOAD_NO_SCALE the advance.x should be in font units (26.6) unless metrics differ.
199 // We divide by 64.0 to get raw font units; convert to our internal PDF user units via unitsToPdf.
200 double rawAdvance266 = static_cast<double>( face->glyph->advance.x );
201 double rawAdvanceFontUnits = rawAdvance266 / 64.0;
202 double advance = unitsToPdf( rawAdvanceFontUnits, m_unitsPerEm );
203
204 uint16_t cid = m_nextCID++;
205
206 if( m_widths.size() <= cid )
207 m_widths.resize( cid + 1, 0.0 );
208
209 if( m_cidToGid.size() <= cid )
210 m_cidToGid.resize( cid + 1, 0 );
211
212 if( m_cidToUnicode.size() <= cid )
213 m_cidToUnicode.resize( cid + 1 );
214
215 m_widths[cid] = advance;
216
217 if( std::getenv( "KICAD_DEBUG_FONT_ADV" ) )
218 {
219 wxLogTrace( tracePdfPlotter,
220 "EnsureGlyph font='%s' gid=%u cid=%u rawAdvance26.6=%f rawAdvanceUnits=%f storedAdvancePdfUnits=%f unitsPerEm=%f", \
221 m_font ? m_font->GetName().ToUTF8().data() : "(null)", (unsigned) aGlyphIndex, (unsigned) cid, \
222 rawAdvance266, rawAdvanceFontUnits, advance, m_unitsPerEm );
223 }
224 m_cidToGid[cid] = static_cast<uint16_t>( aGlyphIndex );
225 m_cidToUnicode[cid] = aUnicode;
226
227 m_glyphMap.emplace( key, cid );
228
229 return cid;
230}
231
232const std::vector<uint8_t>& PDF_OUTLINE_FONT_SUBSET::FontFileData()
233{
234 if( !m_fontDataLoaded )
235 {
236 m_fontDataLoaded = true;
237
238 if( !m_font )
239 return m_fontData;
240
241 wxString fontFile = m_font->GetFileName();
242
243 if( fontFile.IsEmpty() )
244 return m_fontData;
245
246 wxFFile file( fontFile, wxT( "rb" ) );
247
248 if( !file.IsOpened() )
249 return m_fontData;
250
251 wxFileOffset length = file.Length();
252
253 if( length > 0 )
254 {
255 m_fontData.resize( static_cast<size_t>( length ) );
256 file.Read( m_fontData.data(), length );
257 }
258 }
259
260 return m_fontData;
261}
262
264{
265 // Return empty if there are no glyphs beyond .notdef
266 if( m_nextCID <= 1 )
267 return std::string( "[]" );
268
269 // PDF expects widths in 1000/em units for CIDFontType2 /W array entries.
270 // m_widths currently stores advance in PDF user units produced by unitsToPdf().
271 // This is a bit of a fudge factor to reconstruct the output width
272 double designScale = 0.0072 * 2.25;
273 int logCount = 0;
274
275 fmt::memory_buffer buffer;
276 fmt::format_to( std::back_inserter( buffer ), "[ 1 [" );
277
278 for( uint16_t cid = 1; cid < m_nextCID; ++cid )
279 {
280 double adv = m_widths[cid];
281 long width1000 = 0;
282
283 if( designScale != 0.0 )
284 width1000 = lrint( adv / designScale );
285
286 fmt::format_to( std::back_inserter( buffer ), " {}", width1000 );
287
288 if( std::getenv( "KICAD_DEBUG_FONT_ADV" ) && logCount < 16 )
289 {
290 wxLogTrace( tracePdfPlotter, "BuildWidthsArray FIXED cid=%u advPdfUnits=%f width1000=%ld", (unsigned) cid, adv, width1000 );
291 ++logCount;
292 }
293 }
294
295 fmt::format_to( std::back_inserter( buffer ), " ] ]" );
296 return std::string( buffer.data(), buffer.size() );
297}
298
300{
301 if( m_nextCID <= 1 )
302 return std::string();
303
304 fmt::memory_buffer buffer;
305
306 std::string cmapName = m_baseFontName + "_ToUnicode";
307
308 fmt::format_to( std::back_inserter( buffer ), "/CIDInit /ProcSet findresource begin\n" );
309 fmt::format_to( std::back_inserter( buffer ), "12 dict begin\n" );
310 fmt::format_to( std::back_inserter( buffer ), "begincmap\n" );
311 fmt::format_to( std::back_inserter( buffer ), "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> def\n" );
312 fmt::format_to( std::back_inserter( buffer ), "/CMapName /{} def\n", cmapName );
313 fmt::format_to( std::back_inserter( buffer ), "/CMapType 2 def\n" );
314 fmt::format_to( std::back_inserter( buffer ), "1 begincodespacerange\n" );
315 fmt::format_to( std::back_inserter( buffer ), "<0000> <FFFF>\n" );
316 fmt::format_to( std::back_inserter( buffer ), "endcodespacerange\n" );
317
318 size_t mappingCount = 0;
319
320 for( uint16_t cid = 1; cid < m_nextCID; ++cid )
321 {
322 if( !m_cidToUnicode[cid].empty() )
323 ++mappingCount;
324 }
325
326 fmt::format_to( std::back_inserter( buffer ), "{} beginbfchar\n", mappingCount );
327
328 for( uint16_t cid = 1; cid < m_nextCID; ++cid )
329 {
330 const std::u32string& unicode = m_cidToUnicode[cid];
331
332 if( unicode.empty() )
333 continue;
334
335 fmt::format_to( std::back_inserter( buffer ), "<{:04X}> <", cid );
336
337 for( uint32_t codepoint : unicode )
338 fmt::format_to( std::back_inserter( buffer ), "{}", formatUnicodeHex( codepoint ) );
339
340 fmt::format_to( std::back_inserter( buffer ), ">\n" );
341 }
342
343 fmt::format_to( std::back_inserter( buffer ), "endbfchar\n" );
344 fmt::format_to( std::back_inserter( buffer ), "endcmap\n" );
345 fmt::format_to( std::back_inserter( buffer ), "CMapName currentdict /CMap defineresource pop\n" );
346 fmt::format_to( std::back_inserter( buffer ), "end\n" );
347 fmt::format_to( std::back_inserter( buffer ), "end\n" );
348
349 return std::string( buffer.data(), buffer.size() );
350}
351
353{
354 std::string data;
355
356 if( m_nextCID == 0 )
357 return data;
358
359 data.resize( static_cast<size_t>( m_nextCID ) * 2, 0 );
360
361 for( uint16_t cid = 0; cid < m_nextCID; ++cid )
362 {
363 uint16_t gid = cid < m_cidToGid.size() ? m_cidToGid[cid] : 0;
364 data[ cid * 2 ] = static_cast<char>( ( gid >> 8 ) & 0xFF );
365 data[ cid * 2 + 1 ] = static_cast<char>( gid & 0xFF );
366 }
367
368 return data;
369}
370
371std::string PDF_OUTLINE_FONT_SUBSET::makeResourceName( unsigned aSubsetIndex )
372{
373 return fmt::format( "/KiCadOutline{}", aSubsetIndex );
374}
375
376std::string PDF_OUTLINE_FONT_SUBSET::sanitizeFontName( const wxString& aName )
377{
378 std::string utf8 = UTF8( aName ).substr();
379 std::string sanitized;
380 sanitized.reserve( utf8.size() );
381
382 for( unsigned char ch : utf8 )
383 {
384 if( std::isalnum( ch ) )
385 sanitized.push_back( static_cast<char>( ch ) );
386 else
387 sanitized.push_back( '-' );
388 }
389
390 if( sanitized.empty() )
391 sanitized = "Font";
392
393 return sanitized;
394}
395
396std::string PDF_OUTLINE_FONT_SUBSET::makeSubsetName( KIFONT::OUTLINE_FONT* aFont, unsigned aSubsetIndex )
397{
398 std::string prefix = generateSubsetPrefix( aSubsetIndex );
399 std::string name = aFont ? sanitizeFontName( aFont->GetName() ) : std::string( "Font" );
400 return fmt::format( "{}+{}", prefix, name );
401}
402
407
409{
410 m_subsets.clear();
412}
413
415{
416 if( !aFont )
417 return nullptr;
418 SUBSET_KEY key{ aFont, aItalic, aBold };
419 auto it = m_subsets.find( key );
420 if( it != m_subsets.end() )
421 return it->second.get();
422 auto subset = std::make_unique<PDF_OUTLINE_FONT_SUBSET>( aFont, m_nextSubsetIndex++ );
423 PDF_OUTLINE_FONT_SUBSET* subsetPtr = subset.get();
424
425 // Synthetic style application: if requested styles not actually present in font face flags.
426 // Distinguish real face style from fake style flags so that a fake italic does not block
427 // PDF shear application. We consider the face to have a real italic only if FT_STYLE_FLAG_ITALIC
428 // is set. (m_fakeItal only indicates substitution missing an italic variant.)
429 bool faceHasRealItalic = false;
430 bool faceHasRealBold = false;
431 if( const FT_Face& face = aFont->GetFace() )
432 {
433 faceHasRealItalic = ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0;
434 faceHasRealBold = ( face->style_flags & FT_STYLE_FLAG_BOLD ) != 0;
435 }
436
437 bool needSyntheticItalic = aItalic && !faceHasRealItalic; // ignore fake italic
438 bool needSyntheticBold = aBold && !faceHasRealBold; // ignore fake bold
439
440 if( std::getenv( "KICAD_DEBUG_SYN_STYLE" ) )
441 {
442 const FT_Face& face = aFont->GetFace();
443 int styleFlags = face ? face->style_flags : 0;
444 const char* fname = aFont->GetName().ToUTF8().data();
445 const char* styleName = ( face && face->style_name ) ? face->style_name : "(null)";
446 bool fakeItal = static_cast<KIFONT::OUTLINE_FONT*>( aFont )->IsFakeItalic();
447 bool fakeBold = static_cast<KIFONT::OUTLINE_FONT*>( aFont )->IsFakeBold();
448 wxLogTrace( tracePdfPlotter,
449 "ensureSubset font='%s' styleName='%s' reqItalic=%d reqBold=%d FT_style_flags=%d "
450 "faceHasRealItalic=%d faceHasRealBold=%d fakeItal=%d fakeBold=%d syntheticItalic=%d "
451 "syntheticBold=%d subsetKey[i=%d b=%d] subsetIdx=%u",
452 fname ? fname : "(null)", styleName, (int) aItalic, (int) aBold, styleFlags,
453 (int) faceHasRealItalic, (int) faceHasRealBold, (int) fakeItal, (int) fakeBold,
454 (int) needSyntheticItalic, (int) needSyntheticBold, (int) aItalic, (int) aBold,
455 subsetPtr->Font()->GetFace() ? subsetPtr->Font()->GetFace()->face_index : 0 );
456 }
457
458 if( needSyntheticItalic || needSyntheticBold )
459 {
460 // Approx italic angle based on shear ITALIC_TILT (radians) => degrees
461 double angleDeg = -std::atan( ITALIC_TILT ) * 180.0 / M_PI; // negative for conventional PDF italicAngle
462 subsetPtr->ForceSyntheticStyle( needSyntheticBold, needSyntheticItalic, angleDeg );
463 if( std::getenv( "KICAD_DEBUG_SYN_STYLE" ) )
464 {
465 wxLogTrace( tracePdfPlotter, "ForceSyntheticStyle applied: bold=%d italic=%d angle=%f", (int) needSyntheticBold, (int) needSyntheticItalic, angleDeg );
466 }
467 }
468
469 m_subsets.emplace( key, std::move( subset ) );
470 return subsetPtr;
471}
472
474 bool aItalicRequested, bool aBoldRequested,
475 std::vector<PDF_OUTLINE_FONT_RUN>* aRuns )
476{
477 if( !aRuns || !aFont )
478 return;
479
480 auto permission = aFont->GetEmbeddingPermission();
481
484 {
485 return;
486 }
487
488 // If italic requested and font has a dedicated italic variant discoverable via style linkage,
489 // the caller should already have selected that font (aFont). We still separate subsets by
490 // italic flag so synthetic slant and regular do not share widths.
491 PDF_OUTLINE_FONT_SUBSET* subset = ensureSubset( aFont, aItalicRequested, aBoldRequested );
492
493 if( !subset )
494 return;
495
496 UTF8 utf8Text( aText );
497 std::string textUtf8 = utf8Text.substr();
498
499 hb_buffer_t* buffer = hb_buffer_create();
500 hb_buffer_set_cluster_level( buffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES );
501 hb_buffer_add_utf8( buffer, textUtf8.c_str(), static_cast<int>( textUtf8.size() ), 0,
502 static_cast<int>( textUtf8.size() ) );
503 hb_buffer_guess_segment_properties( buffer );
504
505 hb_font_t* hbFont = hb_ft_font_create_referenced( aFont->GetFace() );
506 hb_ft_font_set_funcs( hbFont );
507 hb_shape( hbFont, buffer, nullptr, 0 );
508
509 unsigned int glyphCount = 0;
510 hb_glyph_info_t* glyphInfo = hb_buffer_get_glyph_infos( buffer, &glyphCount );
511 hb_glyph_position_t* glyphPos = hb_buffer_get_glyph_positions( buffer, &glyphCount );
512
513 hb_font_destroy( hbFont );
514
515 if( glyphCount == 0 )
516 {
517 hb_buffer_destroy( buffer );
518 return;
519 }
520
522 run.m_subset = subset;
523
524 bool hasVisibleGlyph = false;
525
526 for( unsigned int ii = 0; ii < glyphCount; ++ii )
527 {
528 uint32_t glyphIndex = glyphInfo[ii].codepoint;
529
530 size_t clusterStart = glyphInfo[ii].cluster;
531 size_t clusterEnd = ( ii + 1 < glyphCount ) ? glyphInfo[ii + 1].cluster : textUtf8.size();
532
533 if( clusterEnd < clusterStart )
534 std::swap( clusterStart, clusterEnd );
535
536 std::string clusterUtf8 = textUtf8.substr( clusterStart, clusterEnd - clusterStart );
537 std::u32string unicode = utf8ToU32( clusterUtf8 );
538
539 if( unicode.empty() )
540 unicode.push_back( 0 );
541
542 uint16_t cid = subset->EnsureGlyph( glyphIndex, unicode );
543
544 if( cid != 0 )
545 hasVisibleGlyph = true;
546
547 run.m_bytes.push_back( static_cast<char>( ( cid >> 8 ) & 0xFF ) );
548 run.m_bytes.push_back( static_cast<char>( cid & 0xFF ) );
549
550 // Capture HarfBuzz positioning information and convert to PDF units
552 glyph.cid = cid;
553 // Convert from 26.6 fixed point to font units, then to PDF units
554 double xAdvanceFontUnits = glyphPos[ii].x_advance / 64.0;
555 double yAdvanceFontUnits = glyphPos[ii].y_advance / 64.0;
556 double xOffsetFontUnits = glyphPos[ii].x_offset / 64.0;
557 double yOffsetFontUnits = glyphPos[ii].y_offset / 64.0;
558
559 glyph.xAdvance = unitsToPdf( xAdvanceFontUnits, subset->UnitsPerEm() );
560 glyph.yAdvance = unitsToPdf( yAdvanceFontUnits, subset->UnitsPerEm() );
561 glyph.xOffset = unitsToPdf( xOffsetFontUnits, subset->UnitsPerEm() );
562 glyph.yOffset = unitsToPdf( yOffsetFontUnits, subset->UnitsPerEm() );
563 run.m_glyphs.push_back( glyph );
564 }
565
566 hb_buffer_destroy( buffer );
567
568 if( hasVisibleGlyph && !run.m_bytes.empty() )
569 aRuns->push_back( std::move( run ) );
570}
571
572std::vector<PDF_OUTLINE_FONT_SUBSET*> PDF_OUTLINE_FONT_MANAGER::AllSubsets() const
573{
574 std::vector<PDF_OUTLINE_FONT_SUBSET*> result;
575 result.reserve( m_subsets.size() );
576
577 for( const auto& [ font, subset ] : m_subsets )
578 {
579 if( subset )
580 result.push_back( subset.get() );
581 }
582
583 return result;
584}
const char * name
const wxString & GetName() const
Definition font.h:112
Class OUTLINE_FONT implements outline font drawing.
const FT_Face & GetFace() const
bool IsItalic() const override
EMBEDDING_PERMISSION GetEmbeddingPermission() const
bool IsBold() const override
std::map< SUBSET_KEY, std::unique_ptr< PDF_OUTLINE_FONT_SUBSET > > m_subsets
void EncodeString(const wxString &aText, KIFONT::OUTLINE_FONT *aFont, bool aItalicRequested, bool aBoldRequested, std::vector< PDF_OUTLINE_FONT_RUN > *aRuns)
PDF_OUTLINE_FONT_SUBSET * ensureSubset(KIFONT::OUTLINE_FONT *aFont, bool aItalic, bool aBold)
std::vector< PDF_OUTLINE_FONT_SUBSET * > AllSubsets() const
std::vector< std::u32string > m_cidToUnicode
std::string BuildToUnicodeCMap() const
uint16_t EnsureGlyph(uint32_t aGlyphIndex, const std::u32string &aUnicode)
std::vector< double > m_widths
KIFONT::OUTLINE_FONT * m_font
std::vector< uint8_t > m_fontData
std::vector< uint16_t > m_cidToGid
static std::string makeSubsetName(KIFONT::OUTLINE_FONT *aFont, unsigned aSubsetIndex)
static std::string sanitizeFontName(const wxString &aName)
const std::vector< uint8_t > & FontFileData()
PDF_OUTLINE_FONT_SUBSET(KIFONT::OUTLINE_FONT *aFont, unsigned aSubsetIndex)
std::string BuildWidthsArray() const
KIFONT::OUTLINE_FONT * Font() const
static std::string makeResourceName(unsigned aSubsetIndex)
std::map< GLYPH_KEY, uint16_t > m_glyphMap
void ForceSyntheticStyle(bool aBold, bool aItalic, double aItalicAngleDeg)
std::string BuildCIDToGIDStream() const
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition utf8.h:67
std::string substr(size_t pos=0, size_t len=npos) const
Definition utf8.h:201
static bool empty(const wxTextEntryBase *aCtrl)
static constexpr double ITALIC_TILT
Tilt factor for italic style (this is the scaling factor on dY relative coordinates to give a tilted ...
Definition font.h:58
const wxChar *const tracePdfPlotter
Flag to enable PDF plotter debug tracing.
PDF_OUTLINE_FONT_SUBSET * m_subset
std::vector< PDF_OUTLINE_FONT_GLYPH > m_glyphs
bool operator<(const GLYPH_KEY &aOther) const
wxString result
Test unit parsing edge cases and error handling.
#define M_PI
wxLogTrace helper definitions.