1 import * as fontkit from "fontkit";
2 var font = await fontkit.openSync('/home/yoxem/桌面/TMP/ts-playground/aliputtat/LinLibertine_DR.otf');
3 var run = font.layout('a̍h',undefined, undefined, undefined, "ltr");
5 for (var i=0;i<=2;i++){
6 console.log(run.glyphs[i]._metrics);
7 console.log(run.glyphs[i].bbox); // bounding box
8 console.log(run.glyphs[i].advanceWidth);
14 假設文字大小為16(px)(=12pt),則下面的數字單位為
15 16/1000 px = [文字pt值]*(4/3)/1000 px
16 454 即 454*16/1000 px;1140即1140*16/1000 px等等。
20 advanceWidth: 454, // 游標前進的長度
21 advanceHeight: 1140, // 游標往下的長度
25 $f34600ab9d7f70d8$export$2e2bcd8739ae039 {
26 minX: 42, // 文字最左邊的x座標
27 minY: -10, // 文字最下邊的y座標
28 maxX: 441, // 文字最右邊的座標
32 //文字glyph字圖寬度 = (441-42)*16/1000 px
33 //文字glyph字圖高度 = (419-(-10))*16/1000 px
43 $f34600ab9d7f70d8$export$2e2bcd8739ae039 {
56 $f34600ab9d7f70d8$export$2e2bcd8739ae039 {