Fix mirrored overbars.
Also fixes a bug that we'd render too many glyphs when some glyphs were combined. (To test, render "text" in Apple Chancery. The opening "te" is combined into a ligature after which we render an extra 't' at the end. Fixes https://gitlab.com/kicad/code/kicad/issues/11441
This commit is contained in:
parent
e6684bf7c7
commit
9b6a10fa6a
|
@ -322,6 +322,10 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
|
|||
|
||||
for( unsigned int i = 0; i < glyphCount; i++ )
|
||||
{
|
||||
// Don't process glyphs that were already included in a previous cluster
|
||||
if( i > 0 && glyphInfo[i].cluster == glyphInfo[i-1].cluster )
|
||||
continue;
|
||||
|
||||
if( aGlyphs )
|
||||
{
|
||||
FT_Load_Glyph( face, glyphInfo[i].codepoint, FT_LOAD_NO_BITMAP );
|
||||
|
@ -431,6 +435,12 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
|
|||
extents.x += aSize.y * ITALIC_TILT;
|
||||
}
|
||||
|
||||
if( aMirror )
|
||||
{
|
||||
topLeft.x = aOrigin.x - ( topLeft.x - aOrigin.x );
|
||||
topRight.x = aOrigin.x - ( topRight.x - aOrigin.x );
|
||||
}
|
||||
|
||||
if( !aAngle.IsZero() )
|
||||
{
|
||||
RotatePoint( topLeft, aOrigin, aAngle );
|
||||
|
|
|
@ -294,21 +294,16 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
|
|||
VECTOR2D barStart( aPosition.x + barOffset.x + barTrim, cursor.y - barOffset.y );
|
||||
VECTOR2D barEnd( cursor.x + barOffset.x - barTrim, cursor.y - barOffset.y );
|
||||
|
||||
if( !aAngle.IsZero() )
|
||||
{
|
||||
RotatePoint( barStart, aOrigin, aAngle );
|
||||
RotatePoint( barEnd, aOrigin, aAngle );
|
||||
}
|
||||
|
||||
if( aGlyphs )
|
||||
{
|
||||
std::unique_ptr<STROKE_GLYPH> overbarGlyph = std::make_unique<STROKE_GLYPH>();
|
||||
STROKE_GLYPH overbarGlyph;
|
||||
|
||||
overbarGlyph->AddPoint( barStart );
|
||||
overbarGlyph->AddPoint( barEnd );
|
||||
overbarGlyph->Finalize();
|
||||
overbarGlyph.AddPoint( barStart );
|
||||
overbarGlyph.AddPoint( barEnd );
|
||||
overbarGlyph.Finalize();
|
||||
|
||||
aGlyphs->push_back( std::move( overbarGlyph ) );
|
||||
aGlyphs->push_back( overbarGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false,
|
||||
aAngle, aMirror, aOrigin ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue