gpt4 book ai didi

c - PDF:如何知道字符的总宽度,包括提前宽度

转载 作者:行者123 更新时间:2023-11-30 20:12:43 25 4
gpt4 key购买 nike

使用 MuPDF 打印为 XML 时显示:

<char bbox="144.1 547.9049 152.682 564.2018" x="144.1" y="560.9" c="T"/>
<char bbox="152.682 547.9049 161.488 564.2018" x="152.682" y="560.9" c="h"/>
<char bbox="161.488 547.9049 165.38002 564.2018" x="161.488" y="560.9" c="i"/>
<char bbox="165.38002 547.9049 175.36201 564.2018" x="165.38002" y="560.9" c="s"/>
<char bbox="175.36201 547.9049 182.44601 564.2018" x="175.36201" y="560.9" c=" "/>
<char bbox="182.44601 547.9049 191.02802 564.2018" x="182.44601" y="560.9" c="a"/>

根据字体字典PDF宽度如下:

Width[000]=0600 Width[001]=0770 Width[002]=0277 Width[003]=0817 Width[004]=0612
Width[005]=0633 Width[006]=0317 Width[007]=0634 Width[008]=0634 Width[009]=0633
Width[010]=0317 Width[011]=0684 Width[012]=0634 Width[013]=0615 Width[014]=0277
Width[015]=0392 Width[016]=0684 Width[017]=0411 Width[018]=0520 Width[019]=0633
Width[020]=0557 Width[021]=0352 Width[022]=0294 Width[023]=0549 Width[024]=0698
Width[025]=0611 Width[026]=0634 Width[027]=1000 Width[028]=0694 Width[029]=0610
Width[030]=0277 Width[031]=0974 Width[032]=0636 Width[033]=0636 Width[034]=0636

我还解码了字体文件的 hmtx 表,显示了高级宽度,如下所示:

 0. advanceWidth= 1229; lsb=102     1. advanceWidth= 1577; lsb=201
2. advanceWidth= 569; lsb=193 3. advanceWidth= 1675; lsb= 86
4. advanceWidth= 1255; lsb=123 5. advanceWidth= 1298; lsb=186
6. advanceWidth= 651; lsb= 0 7. advanceWidth= 1300; lsb=135
8. advanceWidth= 1300; lsb=113 9. advanceWidth= 1298; lsb=186
10. advanceWidth= 651; lsb=219 11. advanceWidth= 1401; lsb= 16
12. advanceWidth= 1300; lsb=186 13. advanceWidth= 1260; lsb=113
14. advanceWidth= 569; lsb=193 15. advanceWidth= 803; lsb= 55
16. advanceWidth= 1401; lsb= 16 17. advanceWidth= 842; lsb=186
18. advanceWidth= 1067; lsb=111 19. advanceWidth= 1298; lsb=174
20. advanceWidth= 1141; lsb=201 21. advanceWidth= 721; lsb= 47
22. advanceWidth= 604; lsb=201 23. advanceWidth= 1126; lsb=113
24. advanceWidth= 1430; lsb=115 25. advanceWidth= 1253; lsb=113
26. advanceWidth= 1300; lsb=113 27. advanceWidth= 2048; lsb=236
28. advanceWidth= 1423; lsb=201 29. advanceWidth= 1251; lsb= -6

head表:

flags=31; unitsPerEm=2048; xMin=-106; yMin=-426; xMax=1958; yMax=1556;
macStyle=0; lowestRecPPEM=8;

HHEA

Ascender=1901;
Descender=-483;

最大P

 maxPoints=48; maxZones=2; maxTwilightPoints=16; maxStorage=153; 
maxFunctionDefs=8; maxInstructionDefs=0; maxStackElements=1045;
maxSizeOfInstructions=534; maxComponentElements=8; maxComponentDepth=4;

当我采用字体字典宽度时,值为:

029|T|084 X Start =>144.100006; X End => 152.640006; Y => 231.100006
009|h|104 X Start =>152.639999; X End => 161.502000; Y => 231.100006
002|i|105 X Start =>161.501999; X End => 165.379999; Y => 231.100006
018|s|115 X Start =>165.380005; X End => 172.660005; Y => 231.100006
006| |032 X Start =>172.660004; X End => 177.098004; Y => 231.100006
004|a|097 X Start =>177.098007; X End => 185.666007; Y => 231.100006

字体大小 = 14

htmx 表中提供的值为emem 的值如何更改为 point

最佳答案

em 是“字体大小”点,因此如果字体大小为 14,则 em 为 14 点。请注意,htmx 表中的单位实际上是 em 的 1/2048,如头表中的 unitsPerEm=2048 条目所指定。

<小时/>

给持怀疑态度的反对者的引用资料:

关于c - PDF:如何知道字符的总宽度,包括提前宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34516699/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com