arrangement api
This commit is contained in:
parent
eb550c0671
commit
7b2393874b
|
@ -339,7 +339,7 @@ proc fillText*(
|
|||
wrap = true,
|
||||
kerning = true
|
||||
) =
|
||||
for path in font.typeset(
|
||||
for _, path in font.typeset(
|
||||
text,
|
||||
bounds,
|
||||
hAlign,
|
||||
|
@ -362,7 +362,7 @@ proc fillText*(
|
|||
wrap = true,
|
||||
kerning = true
|
||||
) =
|
||||
for path in font.typeset(
|
||||
for _, path in font.typeset(
|
||||
text,
|
||||
bounds,
|
||||
hAlign,
|
||||
|
@ -387,7 +387,7 @@ proc strokeText*(
|
|||
wrap = true,
|
||||
kerning = true
|
||||
) =
|
||||
for path in font.typeset(
|
||||
for _, path in font.typeset(
|
||||
text,
|
||||
bounds,
|
||||
hAlign,
|
||||
|
@ -411,7 +411,7 @@ proc strokeText*(
|
|||
wrap = true,
|
||||
kerning = true
|
||||
) =
|
||||
for path in font.typeset(
|
||||
for _, path in font.typeset(
|
||||
text,
|
||||
bounds,
|
||||
hAlign,
|
||||
|
|
|
@ -255,14 +255,16 @@ proc typeset*(
|
|||
result.positions[i].y += yAdjustment
|
||||
result.selectionRects[i].y += yAdjustment
|
||||
|
||||
iterator paths*(arrangement: Arrangement): Path =
|
||||
for i in 0 ..< arrangement.runes.len:
|
||||
if arrangement.runes[i].uint32 > SP.uint32: # Don't draw control runes
|
||||
var path = arrangement.font.typeface.getGlyphPath(arrangement.runes[i])
|
||||
path.transform(
|
||||
proc getPath*(arrangement: Arrangement, i: int): Path =
|
||||
result = arrangement.font.typeface.getGlyphPath(arrangement.runes[i])
|
||||
result.transform(
|
||||
translate(arrangement.positions[i]) * scale(vec2(arrangement.font.scale))
|
||||
)
|
||||
yield path
|
||||
|
||||
iterator paths*(arrangement: Arrangement): (int, Path) =
|
||||
for i in 0 ..< arrangement.runes.len:
|
||||
if arrangement.runes[i].uint32 > SP.uint32: # Don't draw control runes
|
||||
yield (i, arrangement.getPath(i))
|
||||
|
||||
proc parseOtf*(buf: string): Font =
|
||||
result.typeface = Typeface()
|
||||
|
|
Loading…
Reference in a new issue