add filePath to typeface
This commit is contained in:
parent
971287ce7e
commit
e186456788
2 changed files with 12 additions and 9 deletions
|
@ -11,15 +11,17 @@ type
|
|||
|
||||
proc readFont*(filePath: string): Font =
|
||||
## Loads a font from a file.
|
||||
case splitFile(filePath).ext.toLowerAscii():
|
||||
of ".ttf":
|
||||
parseTtf(readFile(filePath))
|
||||
of ".otf":
|
||||
parseOtf(readFile(filePath))
|
||||
of ".svg":
|
||||
parseSvgFont(readFile(filePath))
|
||||
else:
|
||||
raise newException(PixieError, "Unsupported font format")
|
||||
result =
|
||||
case splitFile(filePath).ext.toLowerAscii():
|
||||
of ".ttf":
|
||||
parseTtf(readFile(filePath))
|
||||
of ".otf":
|
||||
parseOtf(readFile(filePath))
|
||||
of ".svg":
|
||||
parseSvgFont(readFile(filePath))
|
||||
else:
|
||||
raise newException(PixieError, "Unsupported font format")
|
||||
result.typeface.filePath = filePath
|
||||
|
||||
converter autoStraightAlpha*(c: ColorRGBX): ColorRGBA {.inline.} =
|
||||
## Convert a paremultiplied alpha RGBA to a straight alpha RGBA.
|
||||
|
|
|
@ -10,6 +10,7 @@ type
|
|||
Typeface* = ref object
|
||||
opentype: OpenType
|
||||
svgFont: SvgFont
|
||||
filePath*: string
|
||||
|
||||
Font* = object
|
||||
typeface*: Typeface
|
||||
|
|
Loading…
Reference in a new issue