0

我在 CGPDFScanner 的 Tf 回调方法中得到“F1.0”。但我不知道如何继续使用“F1.0”

经过一番搜索,我知道它是字体细节之王。我如何解码这个值。

4

1 回答 1

1

字体对象位于 /Resources 字典中。如果你正在解析一个页面内容流,你会得到这样的字体对象:从 Page 字典中获取 /Resources 字典。从 /Resources 字典中获取 /Font 字典。从 /Font 字典中获取带有标签 /F1.0 的字体字典。基本上代码如下所示(您需要添加错误处理代码,因为这些字典可以为 NULL):

CGPDFDictionaryRef pageDictionary = CGPDFPageGetDictionary(pdfPage);

CGPDFDictionaryRef resourcesDictionary;
CGPDFDictionaryGetDictionary(pageDictionary, "Resources", &resourcesDictionary);

CGPDFDictionaryRef fontDictionary;
CGPDFDictionaryGetDictionary(resourcesDictionary, "Font", &fontDictionary);

CGPDFDictionaryRef f10FontDictionary;
CGPDFDictionaryGetDictionary(fontDictionary, "F1.0", &f10FontDictionary);

f10FontDictionary 将包含字体对象。本词典中的条目在 PDF 规范中有详细说明。

于 2012-02-09T10:59:21.297 回答