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 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 ), m_glyphs( nullptr ), m_glyphBoundingBoxes( nullptr )
52 {
53 }
54 
55 
56 bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNewStrokeFontSize )
57 {
59  {
62  return true;
63  }
64 
66  g_newStrokeFontGlyphs->reserve( aNewStrokeFontSize );
67 
68  g_newStrokeFontGlyphBoundingBoxes = new std::vector<BOX2D>;
69  g_newStrokeFontGlyphBoundingBoxes->reserve( aNewStrokeFontSize );
70 
71  for( int j = 0; j < aNewStrokeFontSize; j++ )
72  {
73  GLYPH* glyph = new GLYPH;
74  double glyphStartX = 0.0;
75  double glyphEndX = 0.0;
76  double glyphWidth = 0.0;
77 
78  std::vector<VECTOR2D>* pointList = nullptr;
79 
80  int strokes = 0;
81  int i = 0;
82 
83  while( aNewStrokeFont[j][i] )
84  {
85 
86  if( aNewStrokeFont[j][i] == ' ' && aNewStrokeFont[j][i+1] == 'R' )
87  strokes++;
88 
89  i += 2;
90  }
91 
92  glyph->reserve( strokes + 1 );
93 
94  i = 0;
95 
96  while( aNewStrokeFont[j][i] )
97  {
98  VECTOR2D point( 0.0, 0.0 );
99  char coordinate[2] = { 0, };
100 
101  for( int k : { 0, 1 } )
102  coordinate[k] = aNewStrokeFont[j][i + k];
103 
104  if( i < 2 )
105  {
106  // The first two values contain the width of the char
107  glyphStartX = ( coordinate[0] - 'R' ) * STROKE_FONT_SCALE;
108  glyphEndX = ( coordinate[1] - 'R' ) * STROKE_FONT_SCALE;
109  glyphWidth = glyphEndX - glyphStartX;
110  }
111  else if( ( coordinate[0] == ' ' ) && ( coordinate[1] == 'R' ) )
112  {
113  if( pointList )
114  pointList->shrink_to_fit();
115 
116  // Raise pen
117  pointList = nullptr;
118  }
119  else
120  {
121  // In stroke font, coordinates values are coded as <value> + 'R',
122  // <value> is an ASCII char.
123  // therefore every coordinate description of the Hershey format has an offset,
124  // it has to be subtracted
125  // Note:
126  // * the stroke coordinates are stored in reduced form (-1.0 to +1.0),
127  // and the actual size is stroke coordinate * glyph size
128  // * a few shapes have a height slightly bigger than 1.0 ( like '{' '[' )
129  point.x = (double) ( coordinate[0] - 'R' ) * STROKE_FONT_SCALE - glyphStartX;
130  #define FONT_OFFSET -10
131  // FONT_OFFSET is here for historical reasons, due to the way the stroke font
132  // was built. It allows shapes coordinates like W M ... to be >= 0
133  // Only shapes like j y have coordinates < 0
134  point.y = (double) ( coordinate[1] - 'R' + FONT_OFFSET ) * STROKE_FONT_SCALE;
135 
136  if( !pointList )
137  {
138  pointList = new std::vector<VECTOR2D>;
139  glyph->push_back( pointList );
140  }
141 
142  pointList->push_back( point );
143  }
144 
145  i += 2;
146  }
147 
148  if( pointList )
149  pointList->shrink_to_fit();
150 
151  // Compute the bounding box of the glyph
152  g_newStrokeFontGlyphBoundingBoxes->emplace_back( computeBoundingBox( glyph, glyphWidth ) );
153  g_newStrokeFontGlyphs->push_back( glyph );
154  }
155 
158  return true;
159 }
160 
161 
162 // Static function:
163 double STROKE_FONT::GetInterline( double aGlyphHeight )
164 {
165  // Do not add the glyph thickness to the interline. This makes bold text line-spacing
166  // different from normal text, which is poor typography.
167  return ( aGlyphHeight * INTERLINE_PITCH_RATIO );
168 }
169 
170 
171 BOX2D STROKE_FONT::computeBoundingBox( const GLYPH* aGLYPH, double aGlyphWidth ) const
172 {
173  VECTOR2D min( 0, 0 );
174  VECTOR2D max( aGlyphWidth, 0 );
175 
176  for( const std::vector<VECTOR2D>* pointList : *aGLYPH )
177  {
178  for( const VECTOR2D& point : *pointList )
179  {
180  min.y = std::min( min.y, point.y );
181  max.y = std::max( max.y, point.y );
182  }
183  }
184 
185  return BOX2D( min, max - min );
186 }
187 
188 
189 void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle )
190 {
191  if( aText.empty() )
192  return;
193 
194  // Context needs to be saved before any transformations
195  m_gal->Save();
196 
197  m_gal->Translate( aPosition );
198  m_gal->Rotate( -aRotationAngle );
199 
200  // Single line height
201  int lineHeight = KiROUND( GetInterline( m_gal->GetGlyphSize().y ) );
202  int lineCount = linesCount( aText );
203  const VECTOR2D& glyphSize = m_gal->GetGlyphSize();
204 
205  // align the 1st line of text
206  switch( m_gal->GetVerticalJustify() )
207  {
209  m_gal->Translate( VECTOR2D( 0, glyphSize.y ) );
210  break;
211 
213  m_gal->Translate( VECTOR2D( 0, glyphSize.y / 2.0 ) );
214  break;
215 
217  break;
218 
219  default:
220  break;
221  }
222 
223  if( lineCount > 1 )
224  {
225  switch( m_gal->GetVerticalJustify() )
226  {
228  break;
229 
231  m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) );
232  break;
233 
235  m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) );
236  break;
237  }
238  }
239 
240  m_gal->SetIsStroke( true );
241  //m_gal->SetIsFill( false );
242 
243  if( m_gal->IsFontBold() )
245 
246  // Split multiline strings into separate ones and draw them line by line
247  size_t begin = 0;
248  size_t newlinePos = aText.find( '\n' );
249 
250  while( newlinePos != aText.npos )
251  {
252  size_t length = newlinePos - begin;
253 
254  drawSingleLineText( aText.substr( begin, length ) );
255  m_gal->Translate( VECTOR2D( 0.0, lineHeight ) );
256 
257  begin = newlinePos + 1;
258  newlinePos = aText.find( '\n', begin );
259  }
260 
261  // Draw the last (or the only one) line
262  if( !aText.empty() )
263  drawSingleLineText( aText.substr( begin ) );
264 
265  m_gal->Restore();
266 }
267 
268 
270 {
271  double xOffset;
272  double yOffset;
273  VECTOR2D baseGlyphSize( m_gal->GetGlyphSize() );
274  double overbar_italic_comp = computeOverbarVerticalPosition() * ITALIC_TILT;
275 
276  if( m_gal->IsTextMirrored() )
277  overbar_italic_comp = -overbar_italic_comp;
278 
279  // Compute the text size
280  VECTOR2D textSize = computeTextLineSize( aText );
281  double half_thickness = m_gal->GetLineWidth()/2;
282 
283  // Context needs to be saved before any transformations
284  m_gal->Save();
285 
286  // First adjust: the text X position is corrected by half_thickness
287  // because when the text with thickness is draw, its full size is textSize,
288  // but the position of lines is half_thickness to textSize - half_thickness
289  // so we must translate the coordinates by half_thickness on the X axis
290  // to place the text inside the 0 to textSize X area.
291  m_gal->Translate( VECTOR2D( half_thickness, 0 ) );
292 
293  // Adjust the text position to the given horizontal justification
294  switch( m_gal->GetHorizontalJustify() )
295  {
297  m_gal->Translate( VECTOR2D( -textSize.x / 2.0, 0 ) );
298  break;
299 
301  if( !m_gal->IsTextMirrored() )
302  m_gal->Translate( VECTOR2D( -textSize.x, 0 ) );
303  break;
304 
306  if( m_gal->IsTextMirrored() )
307  m_gal->Translate( VECTOR2D( -textSize.x, 0 ) );
308  break;
309 
310  default:
311  break;
312  }
313 
314  if( m_gal->IsTextMirrored() )
315  {
316  // In case of mirrored text invert the X scale of points and their X direction
317  // (m_glyphSize.x) and start drawing from the position where text normally should end
318  // (textSize.x)
319  xOffset = textSize.x - m_gal->GetLineWidth();
320  baseGlyphSize.x = -baseGlyphSize.x;
321  }
322  else
323  {
324  xOffset = 0.0;
325  }
326 
327  // The overbar is indented inward at the beginning of an italicized section, but
328  // must not be indented on subsequent letters to ensure that the bar segments
329  // overlap.
330  bool last_had_overbar = false;
331  bool in_overbar = false;
332  bool in_super_or_subscript = false;
333  VECTOR2D glyphSize = baseGlyphSize;
334 
335  yOffset = 0;
336 
337  for( UTF8::uni_iter chIt = aText.ubegin(), end = aText.uend(); chIt < end; ++chIt )
338  {
339  // Handle tabs as locked to the nearest 4th column (counting in spaces)
340  // The choice of spaces is somewhat arbitrary but sufficient for aligning text
341  if( *chIt == '\t' )
342  {
343  double space = glyphSize.x * m_glyphBoundingBoxes->at( 0 ).GetEnd().x;
344 
345  // We align to the 4th column (fmod) but only need to account for 3 of
346  // the four spaces here with the extra. This ensures that we have at
347  // least 1 space for the \t character
348  double addlSpace = 3.0 * space - std::fmod( xOffset, 4.0 * space );
349 
350  // Add the remaining space (between 0 and 3 spaces)
351  // The fourth space is added by the 'dd' character
352  xOffset += addlSpace;
353 
354  glyphSize = baseGlyphSize;
355  yOffset = 0;
356  }
357  else if( *chIt == '~' )
358  {
359  if( ++chIt == end )
360  break;
361 
362  if( *chIt == '~' )
363  {
364  // double ~ is really a ~ so go ahead and process the second one
365 
366  // so what's a triple ~? It could be a real ~ followed by an overbar, or
367  // it could be an overbar followed by a real ~. The old algorithm did the
368  // former so we will too....
369  }
370  else
371  {
372  in_overbar = !in_overbar;
373  }
374  }
375  else if( *chIt == '^' )
376  {
377  auto lookahead = chIt;
378 
379  if( ++lookahead != end && *lookahead == '{' )
380  {
381  // process superscript
382  chIt = lookahead;
383  in_super_or_subscript = true;
384  glyphSize = baseGlyphSize * 0.8;
385  yOffset = -baseGlyphSize.y * 0.3;
386  continue;
387  }
388  }
389  else if( *chIt == '_' )
390  {
391  auto lookahead = chIt;
392 
393  if( ++lookahead != end && *lookahead == '{' )
394  {
395  // process subscript
396  chIt = lookahead;
397  in_super_or_subscript = true;
398  glyphSize = baseGlyphSize * 0.8;
399  yOffset = baseGlyphSize.y * 0.1;
400  continue;
401  }
402  }
403  else if( *chIt == '}' && in_super_or_subscript )
404  {
405  in_super_or_subscript = false;
406  glyphSize = baseGlyphSize;
407  yOffset = 0;
408  continue;
409  }
410 
411  // Index into bounding boxes table
412  int dd = (signed) *chIt - ' ';
413 
414  if( dd >= (int) m_glyphBoundingBoxes->size() || dd < 0 )
415  {
416  int substitute = *chIt == '\t' ? ' ' : '?';
417  dd = substitute - ' ';
418  }
419 
420  const GLYPH* glyph = m_glyphs->at( dd );
421  const BOX2D& bbox = m_glyphBoundingBoxes->at( dd );
422 
423  if( in_overbar )
424  {
425  double overbar_start_x = xOffset;
426  double overbar_start_y = - computeOverbarVerticalPosition();
427  double overbar_end_x = xOffset + glyphSize.x * bbox.GetEnd().x;
428  double overbar_end_y = overbar_start_y;
429 
430  if( !last_had_overbar )
431  {
432  if( m_gal->IsFontItalic() )
433  overbar_start_x += overbar_italic_comp;
434 
435  last_had_overbar = true;
436  }
437 
438  VECTOR2D startOverbar( overbar_start_x, overbar_start_y );
439  VECTOR2D endOverbar( overbar_end_x, overbar_end_y );
440 
441  m_gal->DrawLine( startOverbar, endOverbar );
442  }
443  else
444  {
445  last_had_overbar = false;
446  }
447 
448  if( m_gal->IsFontUnderlined() )
449  {
450  double vOffset = computeUnderlineVerticalPosition();
451  VECTOR2D startUnderline( xOffset, - vOffset );
452  VECTOR2D endUnderline( xOffset + glyphSize.x * bbox.GetEnd().x, - vOffset );
453 
454  m_gal->DrawLine( startUnderline, endUnderline );
455  }
456 
457  for( const std::vector<VECTOR2D>* ptList : *glyph )
458  {
459  std::deque<VECTOR2D> ptListScaled;
460 
461  for( const VECTOR2D& pt : *ptList )
462  {
463  VECTOR2D scaledPt( pt.x * glyphSize.x + xOffset, pt.y * glyphSize.y + yOffset );
464 
465  if( m_gal->IsFontItalic() )
466  {
467  // FIXME should be done other way - referring to the lowest Y value of point
468  // because now italic fonts are translated a bit
469  if( m_gal->IsTextMirrored() )
470  scaledPt.x += scaledPt.y * STROKE_FONT::ITALIC_TILT;
471  else
472  scaledPt.x -= scaledPt.y * STROKE_FONT::ITALIC_TILT;
473  }
474 
475  ptListScaled.push_back( scaledPt );
476  }
477 
478  m_gal->DrawPolyline( ptListScaled );
479  }
480 
481  xOffset += glyphSize.x * bbox.GetEnd().x;
482  }
483 
484  m_gal->Restore();
485 }
486 
487 
488 double STROKE_FONT::ComputeOverbarVerticalPosition( double aGlyphHeight ) const
489 {
490  // Static method.
491  return aGlyphHeight * OVERBAR_POSITION_FACTOR;
492 }
493 
494 
496 {
497  // Compute the Y position of the overbar. This is the distance between
498  // the text base line and the overbar axis.
500 }
501 
502 
504 {
505  // Compute the Y position of the underline. This is the distance between
506  // the text base line and the underline axis.
508 }
509 
510 
512 {
514 }
515 
516 
518  double aGlyphThickness ) const
519 {
520  VECTOR2D string_bbox;
521  int line_count = 1;
522  double maxX = 0.0, curX = 0.0;
523 
524  double curScale = 1.0;
525  bool in_overbar = false;
526  bool in_super_or_subscript = false;
527 
528  for( UTF8::uni_iter it = aText.ubegin(), end = aText.uend(); it < end; ++it )
529  {
530  if( *it == '\n' )
531  {
532  curX = 0.0;
533  maxX = std::max( maxX, curX );
534  ++line_count;
535  continue;
536  }
537 
538  // Handle tabs as locked to the nearest 4th column (counting in spaces)
539  // The choice of spaces is somewhat arbitrary but sufficient for aligning text
540  if( *it == '\t' )
541  {
542  double spaces = m_glyphBoundingBoxes->at( 0 ).GetEnd().x;
543  double addlSpace = 3.0 * spaces - std::fmod( curX, 4.0 * spaces );
544 
545  // Add the remaining space (between 0 and 3 spaces)
546  curX += addlSpace;
547 
548  // Tab ends a super- or subscript
549  curScale = 1.0;
550  }
551  else if( *it == '~' )
552  {
553  if( ++it == end )
554  break;
555 
556  if( *it == '~' )
557  {
558  // double ~ is really a ~ so go ahead and process the second one
559 
560  // so what's a triple ~? It could be a real ~ followed by an overbar, or
561  // it could be an overbar followed by a real ~. The old algorithm did the
562  // former so we will too....
563  }
564  else
565  {
566  // single ~ toggles overbar
567  in_overbar = !in_overbar;
568  }
569  }
570  else if( *it == '^' || *it == '_' )
571  {
572  auto lookahead = it;
573 
574  if( ++lookahead != end && *lookahead == '{' )
575  {
576  // process superscript
577  it = lookahead;
578  in_super_or_subscript = true;
579  curScale = 0.8;
580  continue;
581  }
582  }
583  else if( *it == '}' && in_super_or_subscript )
584  {
585  in_super_or_subscript = false;
586  curScale = 1.0;
587  continue;
588  }
589 
590  // Index in the bounding boxes table
591  int dd = (signed) *it - ' ';
592 
593  if( dd >= (int) m_glyphBoundingBoxes->size() || dd < 0 )
594  {
595  int substitute = *it == '\t' ? ' ' : '?';
596  dd = substitute - ' ';
597  }
598 
599  const BOX2D& box = m_glyphBoundingBoxes->at( dd );
600  curX += box.GetEnd().x * curScale;
601  }
602 
603  string_bbox.x = std::max( maxX, curX ) * aGlyphSize.x;
604  string_bbox.x += aGlyphThickness;
605  string_bbox.y = line_count * GetInterline( aGlyphSize.y );
606 
607  // For italic correction, take in account italic tilt
608  if( m_gal->IsFontItalic() )
609  string_bbox.x += string_bbox.y * STROKE_FONT::ITALIC_TILT;
610 
611  return string_bbox;
612 }
std::vector< std::vector< VECTOR2D > * > GLYPH
Definition: stroke_font.h:43
UTF8 is an 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to...
Definition: utf8.h:73
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
static constexpr std::string::size_type npos
Definition: utf8.h:155
float GetLineWidth() const
Get the line width.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
const Vec GetEnd() const
Definition: box2.h:195
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
Factor that determines relative line width for bold text.
Definition: stroke_font.h:174
BOX2< VECTOR2D > BOX2D
Definition: box2.h:523
uni_iter uend() const
Function uend returns a uni_iter initialized to the end of "this" UTF8 byte sequence.
Definition: utf8.h:294
bool LoadNewStrokeFont(const char *const aNewStrokeFont[], int aNewStrokeFontSize)
Load the new stroke font.
Definition: stroke_font.cpp:56
static const double ITALIC_TILT
Tilt factor for italic style (the is is the scaling factor on dY relative coordinates to give a tilst...
Definition: stroke_font.h:181
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify() const
Returns 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
Function ubegin returns a uni_iter initialized to the start of "this" UTF8 byte sequence.
Definition: utf8.h:285
bool IsFontUnderlined() const
std::string::size_type find(char c) const
Definition: utf8.h:110
GAL * m_gal
Pointer to the GAL.
Definition: stroke_font.h:116
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
VECTOR2D computeTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
static const double UNDERLINE_POSITION_FACTOR
Definition: stroke_font.h:171
double computeUnderlineVerticalPosition() const
static const double INTERLINE_PITCH_RATIO
Factor that determines the pitch between 2 lines.
Definition: stroke_font.h:184
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:46
uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string...
Definition: utf8.h:207
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
Scale factor for a glyph
Definition: stroke_font.h:177
void drawSingleLineText(const UTF8 &aText)
Draws 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:160
#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:68
static const double OVERBAR_POSITION_FACTOR
Factor that determines relative vertical position of the overbar.
Definition: stroke_font.h:170
const std::vector< BOX2D > * m_glyphBoundingBoxes
Bounding boxes of the glyphs.
Definition: stroke_font.h:118
std::string substr(size_t pos=0, size_t len=npos) const
Definition: utf8.h:182
virtual void Save()
Save the context.
const GLYPH_LIST * m_glyphs
Glyph list.
Definition: stroke_font.h:117
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.
Class GAL is the abstract interface for drawing on a 2D-surface.
bool empty() const
Definition: utf8.h:108