]>
git.kianting.info Git - clo/blob - 參考資料-Harfbuzz如何使用.py
9 blob
= hb
.Blob
.from_file_path(fontfile
)
14 scale
= 1000000.0/952997
15 font
.scale
= (px
*scale
* 1024, px
*scale
* 1024)
19 buf
.guess_segment_properties()
21 features
= {"kern": True, "liga": True}
22 hb
.shape(font
, buf
, features
)
24 infos
= buf
.glyph_infos
25 positions
= buf
.glyph_positions
27 for info
, pos
in zip(infos
, positions
):
29 cluster
= info
.cluster
30 x_advance
= pos
.x_advance
/ 1024
31 y_advance
= pos
.y_advance
/ 1024
32 x_offset
= pos
.x_offset
/ 1024
33 y_offset
= pos
.y_offset
/1024
34 print(f
"gid{gid}={cluster}@{x_advance},{y_offset}+{x_advance},{y_advance}")