KiCad PCB EDA Suite
stroke_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 (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
5  * Copyright (C) 2013 CERN
6  * @author Maciej Suminski <maciej.suminski@cern.ch>
7  * Copyright (C) 2016-2021 Kicad Developers, see change_log.txt for contributors.
8  *
9  * Stroke font class
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, you may find one here:
23  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24  * or you may search the http://www.gnu.org website for the version 2 license,
25  * or you may write to the Free Software Foundation, Inc.,
26  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27  */
28 
29 #include <gal/stroke_font.h>
31 #include <math/util.h> // for KiROUND
32 #include <wx/string.h>
33 #include <gr_text.h>
34 
35 
36 using namespace KIGFX;
37 
38 const double STROKE_FONT::INTERLINE_PITCH_RATIO = 1.61;
39 const double STROKE_FONT::OVERBAR_POSITION_FACTOR = 1.33;
40 const double STROKE_FONT::UNDERLINE_POSITION_FACTOR = 0.41;
41 const double STROKE_FONT::BOLD_FACTOR = 1.3;
42 const double STROKE_FONT::STROKE_FONT_SCALE = 1.0 / 21.0;
43 const double STROKE_FONT::ITALIC_TILT = 1.0 / 8;
44 
45 
47 std::vector<BOX2D>* g_newStrokeFontGlyphBoundingBoxes;
48 
49 
51  m_gal( aGal ),
52  m_glyphs( nullptr ),
53  m_glyphBoundingBoxes( nullptr )
54 {
55 }
56 
57 
58 bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNewStrokeFontSize )
59 {
61  {
64  return true;
65  }
66 
68  g_newStrokeFontGlyphs->reserve( aNewStrokeFontSize );
69 
70  g_newStrokeFontGlyphBoundingBoxes = new std::vector<BOX2D>;
71  g_newStrokeFontGlyphBoundingBoxes->reserve( aNewStrokeFontSize );
72 
73  for( int j = 0; j < aNewStrokeFontSize; j++ )
74  {
75  GLYPH* glyph = new GLYPH;
76  double glyphStartX = 0.0;
77  double glyphEndX = 0.0;
78  double glyphWidth = 0.0;
79 
80  std::vector<VECTOR2D>* pointList = nullptr;
81 
82  int strokes = 0;
83  int i = 0;
84 
85  while( aNewStrokeFont[j][i] )
86  {
87 
88  if( aNewStrokeFont[j][i] == ' ' && aNewStrokeFont[j][i+1] == 'R' )
89  strokes++;
90 
91  i += 2;
92  }
93 
94  glyph->reserve( strokes + 1 );
95 
96  i = 0;
97 
98  while( aNewStrokeFont[j][i] )
99  {
100  VECTOR2D point( 0.0, 0.0 );
101  char coordinate[2] = { 0, };
102 
103  for( int k : { 0, 1 } )
104  coordinate[k] = aNewStrokeFont[j][i + k];
105 
106  if( i < 2 )
107  {
108  // The first two values contain the width of the char
109  glyphStartX = ( coordinate[0] - 'R' ) * STROKE_FONT_SCALE;
110  glyphEndX = ( coordinate[1] - 'R' ) * STROKE_FONT_SCALE;
111  glyphWidth = glyphEndX - glyphStartX;
112  }
113  else if( ( coordinate[0] == ' ' ) && ( coordinate[1] == 'R' ) )
114  {
115  if( pointList )
116  pointList->shrink_to_fit();
117 
118  // Raise pen
119  pointList = nullptr;
120  }
121  else
122  {
123  // In stroke font, coordinates values are coded as <value> + 'R',
124  // <value> is an ASCII char.
125  // therefore every coordinate description of the Hershey format has an offset,
126  // it has to be subtracted
127  // Note:
128  // * the stroke coordinates are stored in reduced form (-1.0 to +1.0),
129  // and the actual size is stroke coordinate * glyph size
130  // * a few shapes have a height slightly bigger than 1.0 ( like '{' '[' )
131  point.x = (double) ( coordinate[0] - 'R' ) * STROKE_FONT_SCALE - glyphStartX;
132  #define FONT_OFFSET -10
133  // FONT_OFFSET is here for historical reasons, due to the way the stroke font
134  // was built. It allows shapes coordinates like W M ... to be >= 0
135  // Only shapes like j y have coordinates < 0
136  point.y = (double) ( coordinate[1] - 'R' + FONT_OFFSET ) * STROKE_FONT_SCALE;
137 
138  if( !pointList )
139  {
140  pointList = new std::vector<VECTOR2D>;
141  glyph->push_back( pointList );
142  }
143 
144  pointList->push_back( point );
145  }
146 
147  i += 2;
148  }
149 
150  if( pointList )
151  pointList->shrink_to_fit();
152 
153  // Compute the bounding box of the glyph
154  g_newStrokeFontGlyphBoundingBoxes->emplace_back( computeBoundingBox( glyph, glyphWidth ) );
155  g_newStrokeFontGlyphs->push_back( glyph );
156  }
157 
160  return true;
161 }
162 
163 
164 // Static function:
165 double STROKE_FONT::GetInterline( double aGlyphHeight )
166 {
167  // Do not add the glyph thickness to the interline. This makes bold text line-spacing
168  // different from normal text, which is poor typography.
169  return ( aGlyphHeight * INTERLINE_PITCH_RATIO );
170 }
171 
172 
173 BOX2D STROKE_FONT::computeBoundingBox( const GLYPH* aGLYPH, double aGlyphWidth ) const
174 {
175  VECTOR2D min( 0, 0 );
176  VECTOR2D max( aGlyphWidth, 0 );
177 
178  for( const std::vector<VECTOR2D>* pointList : *aGLYPH )
179  {
180  for( const VECTOR2D& point : *pointList )
181  {
182  min.y = std::min( min.y, point.y );
183  max.y = std::max( max.y, point.y );
184  }
185  }
186 
187  return BOX2D( min, max - min );
188 }
189 
190 
191 void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle )
192 {
193  if( aText.empty() )
194  return;
195 
196  // Context needs to be saved before any transformations
197  m_gal->Save();
198 
199  m_gal->Translate( aPosition );
200  m_gal->Rotate( -aRotationAngle );
201 
202  // Single line height
203  int lineHeight = KiROUND( GetInterline( m_gal->GetGlyphSize().y ) );
204  int lineCount = linesCount( aText );
205  const VECTOR2D& glyphSize = m_gal->GetGlyphSize();
206 
207  // align the 1st line of text
208  switch( m_gal->GetVerticalJustify() )
209  {
211  m_gal->Translate( VECTOR2D( 0, glyphSize.y ) );
212  break;
213 
215  m_gal->Translate( VECTOR2D( 0, glyphSize.y / 2.0 ) );
216  break;
217 
219  break;
220 
221  default:
222  break;
223  }
224 
225  if( lineCount > 1 )
226  {
227  switch( m_gal->GetVerticalJustify() )
228  {
230  break;
231 
233  m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) );
234  break;
235 
237  m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) );
238  break;
239  }
240  }
241 
242  m_gal->SetIsStroke( true );
243  //m_gal->SetIsFill( false );
244 
245  if( m_gal->IsFontBold() )
247 
248  // Split multiline strings into separate ones and draw them line by line
249  size_t begin = 0;
250  size_t newlinePos = aText.find( '\n' );
251 
252  while( newlinePos != aText.npos )
253  {
254  size_t length = newlinePos - begin;
255 
256  drawSingleLineText( aText.substr( begin, length ) );
257  m_gal->Translate( VECTOR2D( 0.0, lineHeight ) );
258 
259  begin = newlinePos + 1;
260  newlinePos = aText.find( '\n', begin );
261  }
262 
263  // Draw the last (or the only one) line
264  if( !aText.empty() )
265  drawSingleLineText( aText.substr( begin ) );
266 
267  m_gal->Restore();
268 }
269 
270 
272 {
273  double xOffset;
274  double yOffset;
275  VECTOR2D baseGlyphSize( m_gal->GetGlyphSize() );
276  double overbar_italic_comp = computeOverbarVerticalPosition() * ITALIC_TILT;
277 
278  if( m_gal->IsTextMirrored() )
279  overbar_italic_comp = -overbar_italic_comp;
280 
281  // Compute the text size
282  VECTOR2D textSize = computeTextLineSize( aText );
283  double half_thickness = m_gal->GetLineWidth()/2;
284 
285  // Context needs to be saved before any transformations
286  m_gal->Save();
287 
288  // First adjust: the text X position is corrected by half_thickness
289  // because when the text with thickness is draw, its full size is textSize,
290  // but the position of lines is half_thickness to textSize - half_thickness
291  // so we must translate the coordinates by half_thickness on the X axis
292  // to place the text inside the 0 to textSize X area.
293  m_gal->Translate( VECTOR2D( half_thickness, 0 ) );
294 
295  // Adjust the text position to the given horizontal justification
296  switch( m_gal->GetHorizontalJustify() )
297  {
299  m_gal->Translate( VECTOR2D( -textSize.x / 2.0, 0 ) );
300  break;
301 
303  if( !m_gal->IsTextMirrored() )
304  m_gal->Translate( VECTOR2D( -textSize.x, 0 ) );
305  break;
306 
308  if( m_gal->IsTextMirrored() )
309  m_gal->Translate( VECTOR2D( -textSize.x, 0 ) );
310  break;
311 
312  default:
313  break;
314  }
315 
316  if( m_gal->IsTextMirrored() )
317  {
318  // In case of mirrored text invert the X scale of points and their X direction
319  // (m_glyphSize.x) and start drawing from the position where text normally should end
320  // (textSize.x)
321  xOffset = textSize.x - m_gal->GetLineWidth();
322  baseGlyphSize.x = -baseGlyphSize.x;
323  }
324  else
325  {
326  xOffset = 0.0;
327  }
328 
329  // The overbar is indented inward at the beginning of an italicized section, but
330  // must not be indented on subsequent letters to ensure that the bar segments
331  // overlap.
332  bool lastHadOverbar = false;
333  int overbarDepth = -1;
334  int superSubDepth = -1;
335  int braceNesting = 0;
336  VECTOR2D glyphSize = baseGlyphSize;
337 
338  // Allocate only once (for performance)
339  std::vector<VECTOR2D> ptListScaled;
340  int char_count = 0;
341 
342  yOffset = 0;
343 
344  for( UTF8::uni_iter chIt = aText.ubegin(), end = aText.uend(); chIt < end; ++chIt )
345  {
346  // Handle tabs as locked to the nearest 4th column (counting in space-widths).
347  // The choice of spaces is somewhat arbitrary but sufficient for aligning text; while
348  // it can produce tabs that go backwards when following wide characters, spacing in
349  // widest-char-widths produces tab spacing that is much too wide (and would change the
350  // layout of existing boards).
351  if( *chIt == '\t' )
352  {
353  char_count = ( char_count / 4 + 1 ) * 4 - 1;
354  xOffset = baseGlyphSize.x * char_count;
355 
356  glyphSize = baseGlyphSize;
357  yOffset = 0;
358  }
359  else if( *chIt == '^' && superSubDepth == -1 )
360  {
361  UTF8::uni_iter lookahead = chIt;
362 
363  if( ++lookahead != end && *lookahead == '{' )
364  {
365  chIt = lookahead;
366  superSubDepth = braceNesting;
367  braceNesting++;
368 
369  glyphSize = baseGlyphSize * 0.8;
370  yOffset = -baseGlyphSize.y * 0.3;
371  continue;
372  }
373  }
374  else if( *chIt == '_' && superSubDepth == -1 )
375  {
376  UTF8::uni_iter lookahead = chIt;
377 
378  if( ++lookahead != end && *lookahead == '{' )
379  {
380  chIt = lookahead;
381  superSubDepth = braceNesting;
382  braceNesting++;
383 
384  glyphSize = baseGlyphSize * 0.8;
385  yOffset = baseGlyphSize.y * 0.1;
386  continue;
387  }
388  }
389  else if( *chIt == '~' && overbarDepth == -1 )
390  {
391  UTF8::uni_iter lookahead = chIt;
392 
393  if( ++lookahead != end && *lookahead == '{' )
394  {
395  chIt = lookahead;
396  overbarDepth = braceNesting;
397  braceNesting++;
398  continue;
399  }
400  }
401  else if( *chIt == '{' )
402  {
403  braceNesting++;
404  }
405  else if( *chIt == '}' )
406  {
407  if( braceNesting > 0 )
408  braceNesting--;
409 
410  if( braceNesting == superSubDepth )
411  {
412  superSubDepth = -1;
413 
414  glyphSize = baseGlyphSize;
415  yOffset = 0;
416  continue;
417  }
418 
419  if( braceNesting == overbarDepth )
420  {
421  overbarDepth = -1;
422  continue;
423  }
424  }
425 
426  // Index into bounding boxes table
427  int dd = (signed) *chIt - ' ';
428 
429  if( dd >= (int) m_glyphBoundingBoxes->size() || dd < 0 )
430  {
431  int substitute = *chIt == '\t' ? ' ' : '?';
432  dd = substitute - ' ';
433  }
434 
435  const GLYPH* glyph = m_glyphs->at( dd );
436  const BOX2D& bbox = m_glyphBoundingBoxes->at( dd );
437 
438  if( overbarDepth != -1 )
439  {
440  double overbar_start_x = xOffset;
441  double overbar_start_y = - computeOverbarVerticalPosition();
442  double overbar_end_x = xOffset + glyphSize.x * bbox.GetEnd().x;
443  double overbar_end_y = overbar_start_y;
444 
445  if( !lastHadOverbar )
446  {
447  if( m_gal->IsFontItalic() )
448  overbar_start_x += overbar_italic_comp;
449 
450  lastHadOverbar = true;
451  }
452 
453  VECTOR2D startOverbar( overbar_start_x, overbar_start_y );
454  VECTOR2D endOverbar( overbar_end_x, overbar_end_y );
455 
456  m_gal->DrawLine( startOverbar, endOverbar );
457  }
458  else
459  {
460  lastHadOverbar = false;
461  }
462 
463  if( m_gal->IsFontUnderlined() )
464  {
465  double vOffset = computeUnderlineVerticalPosition();
466  VECTOR2D startUnderline( xOffset, - vOffset );
467  VECTOR2D endUnderline( xOffset + glyphSize.x * bbox.GetEnd().x, - vOffset );
468 
469  m_gal->DrawLine( startUnderline, endUnderline );
470  }
471 
472  for( const std::vector<VECTOR2D>* ptList : *glyph )
473  {
474  int ptCount = 0;
475  ptListScaled.clear();
476 
477  for( const VECTOR2D& pt : *ptList )
478  {
479  VECTOR2D scaledPt( pt.x * glyphSize.x + xOffset, pt.y * glyphSize.y + yOffset );
480 
481  if( m_gal->IsFontItalic() )
482  {
483  // FIXME should be done other way - referring to the lowest Y value of point
484  // because now italic fonts are translated a bit
485  if( m_gal->IsTextMirrored() )
486  scaledPt.x += scaledPt.y * STROKE_FONT::ITALIC_TILT;
487  else
488  scaledPt.x -= scaledPt.y * STROKE_FONT::ITALIC_TILT;
489  }
490 
491  ptListScaled.push_back( scaledPt );
492  ptCount++;
493  }
494 
495  m_gal->DrawPolyline( &ptListScaled[0], ptCount );
496  }
497 
498  char_count++;
499  xOffset += glyphSize.x * bbox.GetEnd().x;
500  }
501 
502  m_gal->Restore();
503 }
504 
505 
506 double STROKE_FONT::ComputeOverbarVerticalPosition( double aGlyphHeight ) const
507 {
508  // Static method.
509  return aGlyphHeight * OVERBAR_POSITION_FACTOR;
510 }
511 
512 
514 {
515  // Compute the Y position of the overbar. This is the distance between
516  // the text base line and the overbar axis.
518 }
519 
520 
522 {
523  // Compute the Y position of the underline. This is the distance between
524  // the text base line and the underline axis.
526 }
527 
528 
530 {
532 }
533 
534 
536  double aGlyphThickness ) const
537 {
538  VECTOR2D string_bbox;
539  int line_count = 1;
540  double maxX = 0.0, curX = 0.0;
541 
542  double curScale = 1.0;
543  int overbarDepth = -1;
544  int superSubDepth = -1;
545  int braceNesting = 0;
546 
547  for( UTF8::uni_iter chIt = aText.ubegin(), end = aText.uend(); chIt < end; ++chIt )
548  {
549  if( *chIt == '\n' )
550  {
551  curX = 0.0;
552  maxX = std::max( maxX, curX );
553  ++line_count;
554  continue;
555  }
556 
557  // Handle tabs as locked to the nearest 4th column (counting in spaces)
558  // The choice of spaces is somewhat arbitrary but sufficient for aligning text
559  if( *chIt == '\t' )
560  {
561  double spaces = m_glyphBoundingBoxes->at( 0 ).GetEnd().x;
562  double addlSpace = 3.0 * spaces - std::fmod( curX, 4.0 * spaces );
563 
564  // Add the remaining space (between 0 and 3 spaces)
565  curX += addlSpace;
566  }
567  else if( (*chIt == '^' || *chIt == '_') && superSubDepth == -1 )
568  {
569  UTF8::uni_iter lookahead = chIt;
570 
571  if( ++lookahead != end && *lookahead == '{' )
572  {
573  // Process superscript
574  chIt = lookahead;
575  superSubDepth = braceNesting;
576  braceNesting++;
577 
578  curScale = 0.8;
579  continue;
580  }
581  }
582  else if( *chIt == '~' && overbarDepth == -1 )
583  {
584  UTF8::uni_iter lookahead = chIt;
585 
586  if( ++lookahead != end && *lookahead == '{' )
587  {
588  chIt = lookahead;
589  overbarDepth = braceNesting;
590  braceNesting++;
591  continue;
592  }
593  }
594  else if( *chIt == '{' )
595  {
596  braceNesting++;
597  }
598  else if( *chIt == '}' )
599  {
600  if( braceNesting > 0 )
601  braceNesting--;
602 
603  if( braceNesting == overbarDepth )
604  {
605  overbarDepth = -1;
606  continue;
607  }
608 
609  if( braceNesting == superSubDepth )
610  {
611  superSubDepth = -1;
612 
613  curScale = 1.0;
614  continue;
615  }
616  }
617 
618  // Index in the bounding boxes table
619  int dd = (signed) *chIt - ' ';
620 
621  if( dd >= (int) m_glyphBoundingBoxes->size() || dd < 0 )
622  {
623  int substitute = *chIt == '\t' ? ' ' : '?';
624  dd = substitute - ' ';
625  }
626 
627  const BOX2D& box = m_glyphBoundingBoxes->at( dd );
628  curX += box.GetEnd().x * curScale;
629  }
630 
631  string_bbox.x = std::max( maxX, curX ) * aGlyphSize.x;
632  string_bbox.x += aGlyphThickness;
633  string_bbox.y = line_count * GetInterline( aGlyphSize.y );
634 
635  // For italic correction, take in account italic tilt
636  if( m_gal->IsFontItalic() )
637  string_bbox.x += string_bbox.y * STROKE_FONT::ITALIC_TILT;
638 
639  return string_bbox;
640 }
std::vector< std::vector< VECTOR2D > * > GLYPH
Definition: stroke_font.h:44
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition: utf8.h:70
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
static constexpr std::string::size_type npos
Definition: utf8.h:151
float GetLineWidth() const
Get the line width.
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:236
const Vec GetEnd() const
Definition: box2.h:178
static double GetInterline(double aGlyphHeight)
Compute the distance (interline) between 2 lines of text (for multiline texts).
bool IsTextMirrored() const
static const double BOLD_FACTOR
Scale factor for a glyph.
Definition: stroke_font.h:177
BOX2< VECTOR2D > BOX2D
Definition: box2.h:507
uni_iter uend() const
Return a uni_iter initialized to the end of "this" UTF8 byte sequence.
Definition: utf8.h:287
bool LoadNewStrokeFont(const char *const aNewStrokeFont[], int aNewStrokeFontSize)
Load the new stroke font.
Definition: stroke_font.cpp:58
static const double ITALIC_TILT
Factor that determines the pitch between 2 lines.
Definition: stroke_font.h:184
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify() const
Return current text horizontal justification setting.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void Rotate(double aAngle)
Rotate the context.
const VECTOR2D & GetGlyphSize() const
uni_iter ubegin() const
Returns a uni_iter initialized to the start of "this" UTF8 byte sequence.
Definition: utf8.h:279
bool IsFontUnderlined() const
std::string::size_type find(char c) const
Definition: utf8.h:105
GAL * m_gal
Pointer to the GAL.
Definition: stroke_font.h:168
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D computeTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
static const double UNDERLINE_POSITION_FACTOR
Factor that determines relative line width for bold text.
Definition: stroke_font.h:174
double computeUnderlineVerticalPosition() const
static const double INTERLINE_PITCH_RATIO
Definition: stroke_font.h:187
VECTOR2D ComputeStringBoundaryLimits(const UTF8 &aText, const VECTOR2D &aGlyphSize, double aGlyphThickness) const
Compute the boundary limits of aText (the bounding box of all shapes).
std::vector< BOX2D > * g_newStrokeFontGlyphBoundingBoxes
Bounding boxes of the glyphs.
Definition: stroke_font.cpp:47
std::vector< GLYPH * > GLYPH_LIST
Definition: stroke_font.h:47
uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string...
Definition: utf8.h:203
GLYPH_LIST * g_newStrokeFontGlyphs
Glyph list.
Definition: stroke_font.cpp:46
void Draw(const UTF8 &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a string.
double computeOverbarVerticalPosition() const
Compute the vertical position of an overbar, sometimes used in texts.
double ComputeOverbarVerticalPosition(double aGlyphHeight) const
Compute the vertical position of an overbar, sometimes used in texts.
STROKE_FONT(GAL *aGal)
Constructor.
Definition: stroke_font.cpp:50
static const double STROKE_FONT_SCALE
Tilt factor for italic style (the is is the scaling factor on dY relative coordinates to give a tilt ...
Definition: stroke_font.h:180
void drawSingleLineText(const UTF8 &aText)
Draw a single line of text.
virtual void Restore()
Restore the context.
EDA_TEXT_VJUSTIFY_T GetVerticalJustify() const
Returns current text vertical justification setting.
unsigned linesCount(const UTF8 &aText) const
Returns number of lines for a given text.
Definition: stroke_font.h:159
#define FONT_OFFSET
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
static const double OVERBAR_POSITION_FACTOR
Definition: stroke_font.h:173
const std::vector< BOX2D > * m_glyphBoundingBoxes
Bounding boxes of the glyphs.
Definition: stroke_font.h:170
std::string substr(size_t pos=0, size_t len=npos) const
Definition: utf8.h:178
virtual void Save()
Save the context.
const GLYPH_LIST * m_glyphs
Glyph list.
Definition: stroke_font.h:169
BOX2D computeBoundingBox(const GLYPH *aGlyph, double aGlyphWidth) const
Compute the bounding box of a given glyph.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
Abstract interface for drawing on a 2D-surface.
bool empty() const
Definition: utf8.h:103