more ttc
This commit is contained in:
parent
dffe86074f
commit
655099a64e
4 changed files with 54 additions and 51 deletions
|
@ -949,10 +949,19 @@ const cffStandardStrings = [
|
|||
const TOP_DICT_META = {
|
||||
0: "version",
|
||||
1: "notice",
|
||||
1200: "copyright",
|
||||
2: "fullName",
|
||||
3: "familyName",
|
||||
4: "weight",
|
||||
5: "fontBBox",
|
||||
|
||||
13: "uniqueId",
|
||||
14: "xuid",
|
||||
15: "charset",
|
||||
16: "encoding",
|
||||
17: "charStrings",
|
||||
18: "private",
|
||||
|
||||
1200: "copyright",
|
||||
1201: "isFixedPitch",
|
||||
1202: "italicAngle",
|
||||
1203: "underlinePosition",
|
||||
|
@ -960,14 +969,7 @@ const TOP_DICT_META = {
|
|||
1205: "paintType",
|
||||
1206: "charstringType",
|
||||
1207: "fontMatrix",
|
||||
13: "uniqueId",
|
||||
5: "fontBBox",
|
||||
1208: "strokeWidth",
|
||||
14: "xuid",
|
||||
15: "charset",
|
||||
16: "encoding",
|
||||
17: "charStrings",
|
||||
18: "private",
|
||||
1230: "ros",
|
||||
1231: "cidFontVersion",
|
||||
1232: "cidFontRevision",
|
||||
|
|
Binary file not shown.
BIN
tests/fonts/PTSans.ttc
Normal file
BIN
tests/fonts/PTSans.ttc
Normal file
Binary file not shown.
|
@ -1,51 +1,52 @@
|
|||
import pixie, strformat, unicode, pixie/fontformats/opentype
|
||||
|
||||
block:
|
||||
var font = readFont("/Windows/Fonts/simsun.ttc")
|
||||
var font = readFont("tests/fonts/PTSans.ttc")
|
||||
font.size = 72
|
||||
let image = newImage(220, 100)
|
||||
let image = newImage(200, 100)
|
||||
image.fill(rgba(255, 255, 255, 255))
|
||||
image.fillText(font, "大目鳥")
|
||||
image.writeFile("ttc.png")
|
||||
image.fillText(font, "AbCd")
|
||||
# image.writeFile("ttc.png")
|
||||
|
||||
block:
|
||||
var fonts = parseOpenTypeCollection(readFile("/Windows/Fonts/simsun.ttc"))
|
||||
for font in fonts:
|
||||
echo font.fullName
|
||||
var fonts = parseOpenTypeCollection(readFile("tests/fonts/PTSans.ttc"))
|
||||
for i, font in fonts:
|
||||
echo i, ": ", font.fullName
|
||||
|
||||
block:
|
||||
let files = @[
|
||||
"/Windows/Fonts/batang.ttc",
|
||||
"/Windows/Fonts/BIZ-UDGothicB.ttc",
|
||||
"/Windows/Fonts/BIZ-UDGothicR.ttc",
|
||||
"/Windows/Fonts/BIZ-UDMinchoM.ttc",
|
||||
"/Windows/Fonts/cambria.ttc",
|
||||
"/Windows/Fonts/gulim.ttc",
|
||||
"/Windows/Fonts/meiryo.ttc",
|
||||
"/Windows/Fonts/meiryob.ttc",
|
||||
"/Windows/Fonts/mingliub.ttc",
|
||||
"/Windows/Fonts/msgothic.ttc",
|
||||
"/Windows/Fonts/msjh.ttc",
|
||||
"/Windows/Fonts/msjhbd.ttc",
|
||||
"/Windows/Fonts/msjhl.ttc",
|
||||
"/Windows/Fonts/msmincho.ttc",
|
||||
"/Windows/Fonts/msyh.ttc",
|
||||
"/Windows/Fonts/msyhbd.ttc",
|
||||
"/Windows/Fonts/msyhl.ttc",
|
||||
"/Windows/Fonts/simsun.ttc",
|
||||
"/Windows/Fonts/Sitka.ttc",
|
||||
"/Windows/Fonts/SitkaB.ttc",
|
||||
"/Windows/Fonts/SitkaI.ttc",
|
||||
"/Windows/Fonts/SitkaZ.ttc",
|
||||
"/Windows/Fonts/UDDigiKyokashoN-B.ttc",
|
||||
"/Windows/Fonts/UDDigiKyokashoN-R.ttc",
|
||||
"/Windows/Fonts/YuGothB.ttc",
|
||||
"/Windows/Fonts/YuGothL.ttc",
|
||||
"/Windows/Fonts/YuGothM.ttc",
|
||||
"/Windows/Fonts/YuGothR.ttc",
|
||||
]
|
||||
for file in files:
|
||||
echo file
|
||||
var fonts = parseOpenTypeCollection(readFile(file))
|
||||
for i, font in fonts:
|
||||
echo " ", i, ": ", font.fullName
|
||||
when defined(windows):
|
||||
block:
|
||||
let files = @[
|
||||
"/Windows/Fonts/batang.ttc",
|
||||
"/Windows/Fonts/BIZ-UDGothicB.ttc",
|
||||
"/Windows/Fonts/BIZ-UDGothicR.ttc",
|
||||
"/Windows/Fonts/BIZ-UDMinchoM.ttc",
|
||||
"/Windows/Fonts/cambria.ttc",
|
||||
"/Windows/Fonts/gulim.ttc",
|
||||
"/Windows/Fonts/meiryo.ttc",
|
||||
"/Windows/Fonts/meiryob.ttc",
|
||||
"/Windows/Fonts/mingliub.ttc",
|
||||
"/Windows/Fonts/msgothic.ttc",
|
||||
"/Windows/Fonts/msjh.ttc",
|
||||
"/Windows/Fonts/msjhbd.ttc",
|
||||
"/Windows/Fonts/msjhl.ttc",
|
||||
"/Windows/Fonts/msmincho.ttc",
|
||||
"/Windows/Fonts/msyh.ttc",
|
||||
"/Windows/Fonts/msyhbd.ttc",
|
||||
"/Windows/Fonts/msyhl.ttc",
|
||||
"/Windows/Fonts/simsun.ttc",
|
||||
"/Windows/Fonts/Sitka.ttc",
|
||||
"/Windows/Fonts/SitkaB.ttc",
|
||||
"/Windows/Fonts/SitkaI.ttc",
|
||||
"/Windows/Fonts/SitkaZ.ttc",
|
||||
"/Windows/Fonts/UDDigiKyokashoN-B.ttc",
|
||||
"/Windows/Fonts/UDDigiKyokashoN-R.ttc",
|
||||
"/Windows/Fonts/YuGothB.ttc",
|
||||
"/Windows/Fonts/YuGothL.ttc",
|
||||
"/Windows/Fonts/YuGothM.ttc",
|
||||
"/Windows/Fonts/YuGothR.ttc",
|
||||
]
|
||||
for file in files:
|
||||
echo file
|
||||
var fonts = parseOpenTypeCollection(readFile(file))
|
||||
for i, font in fonts:
|
||||
echo " ", i, ": ", font.fullName
|
||||
|
|
Loading…
Reference in a new issue