X-Git-Url: https://git.kianting.info/?a=blobdiff_plain;f=%E5%8F%83%E8%80%83%E8%B3%87%E6%96%99-Harfbuzz%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8.py;fp=%E5%8F%83%E8%80%83%E8%B3%87%E6%96%99-Harfbuzz%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8.py;h=0000000000000000000000000000000000000000;hb=5bf5f5cbe5ea126867fbc1ffb9d88dec36e94931;hp=128ade27c72695743b2d73cdef0db6c03671ee8e;hpb=eeb98157020c3a0e3f7481ef397b09a741f726bb;p=clo diff --git "a/\345\217\203\350\200\203\350\263\207\346\226\231-Harfbuzz\345\246\202\344\275\225\344\275\277\347\224\250.py" "b/\345\217\203\350\200\203\350\263\207\346\226\231-Harfbuzz\345\246\202\344\275\225\344\275\277\347\224\250.py" deleted file mode 100644 index 128ade2..0000000 --- "a/\345\217\203\350\200\203\350\263\207\346\226\231-Harfbuzz\345\246\202\344\275\225\344\275\277\347\224\250.py" +++ /dev/null @@ -1,34 +0,0 @@ -import sys - -import uharfbuzz as hb - - -fontfile = sys.argv[1] -text = sys.argv[2] - -blob = hb.Blob.from_file_path(fontfile) -face = hb.Face(blob) -font = hb.Font(face) - -px = 96 -scale = 1000000.0/952997 -font.scale = (px *scale* 1024, px*scale * 1024) - -buf = hb.Buffer() -buf.add_str(text) -buf.guess_segment_properties() - -features = {"kern": True, "liga": True} -hb.shape(font, buf, features) - -infos = buf.glyph_infos -positions = buf.glyph_positions - -for info, pos in zip(infos, positions): - gid = info.codepoint - cluster = info.cluster - x_advance = pos.x_advance / 1024 - y_advance = pos.y_advance / 1024 - x_offset = pos.x_offset / 1024 - y_offset = pos.y_offset /1024 - print(f"gid{gid}={cluster}@{x_advance},{y_offset}+{x_advance},{y_advance}") \ No newline at end of file