Fix strikethough and underline for CFF fonts with winding order flag.
|
@ -2415,6 +2415,12 @@ proc getKerningAdjustment*(
|
||||||
elif opentype.kern != nil:
|
elif opentype.kern != nil:
|
||||||
result = opentype.kern.kerningPairs.getOrDefault(glyphPair, 0)
|
result = opentype.kern.kerningPairs.getOrDefault(glyphPair, 0)
|
||||||
|
|
||||||
|
proc getWindingOrder*(opentype: OpenType): bool =
|
||||||
|
## Returns the expected winding order of a font.
|
||||||
|
## Gyph - false - clockwise
|
||||||
|
## CFF - true - counterclockwise
|
||||||
|
return opentype.cff == nil
|
||||||
|
|
||||||
proc parseOpenType*(buf: string): OpenType {.raises: [PixieError].} =
|
proc parseOpenType*(buf: string): OpenType {.raises: [PixieError].} =
|
||||||
result = OpenType()
|
result = OpenType()
|
||||||
result.buf = buf
|
result.buf = buf
|
||||||
|
|
|
@ -92,6 +92,12 @@ proc strikeoutThickness(typeface: Typeface): float32 =
|
||||||
if typeface.opentype != nil:
|
if typeface.opentype != nil:
|
||||||
result = typeface.opentype.os2.yStrikeoutSize.float32
|
result = typeface.opentype.os2.yStrikeoutSize.float32
|
||||||
|
|
||||||
|
proc getWindingOrder(typeface: Typeface): bool =
|
||||||
|
## Returns the expected winding order of a font.
|
||||||
|
if typeface.opentype != nil:
|
||||||
|
return typeface.opentype.getWindingOrder()
|
||||||
|
return true
|
||||||
|
|
||||||
proc getGlyphPath*(
|
proc getGlyphPath*(
|
||||||
typeface: Typeface, rune: Rune
|
typeface: Typeface, rune: Rune
|
||||||
): Path {.inline, raises: [PixieError].} =
|
): Path {.inline, raises: [PixieError].} =
|
||||||
|
@ -478,14 +484,16 @@ proc textUber(
|
||||||
arrangement.selectionRects[runeIndex].x,
|
arrangement.selectionRects[runeIndex].x,
|
||||||
position.y - underlinePosition + underlineThickness / 2,
|
position.y - underlinePosition + underlineThickness / 2,
|
||||||
arrangement.selectionRects[runeIndex].w,
|
arrangement.selectionRects[runeIndex].w,
|
||||||
underlineThickness
|
underlineThickness,
|
||||||
|
font.typeface.getWindingOrder()
|
||||||
)
|
)
|
||||||
if font.strikethrough:
|
if font.strikethrough:
|
||||||
path.rect(
|
path.rect(
|
||||||
arrangement.selectionRects[runeIndex].x,
|
arrangement.selectionRects[runeIndex].x,
|
||||||
position.y - strikeoutPosition,
|
position.y - strikeoutPosition,
|
||||||
arrangement.selectionRects[runeIndex].w,
|
arrangement.selectionRects[runeIndex].w,
|
||||||
strikeoutThickness
|
strikeoutThickness,
|
||||||
|
font.typeface.getWindingOrder()
|
||||||
)
|
)
|
||||||
|
|
||||||
when stroke:
|
when stroke:
|
||||||
|
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |