PDF:我怎么觉得多少空间渲染时将文本占用? [英] PDF: how do I find how much space will the text occupy when rendered?

查看:99
本文介绍了PDF:我怎么觉得多少空间渲染时将文本占用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在C.有点PDF库时生成PDF源$ C ​​$ C,负责绘制文本,我需要知道呈现的文本,以便正确地渲染下段所占的空间。

I am writing a little PDF library in C. When generating PDF source code that is responsible for rendering text, I need to know how much space the rendered text occupies in order to render the next paragraph correctly.

我如何知道的?

感谢您!

推荐答案

的机制和PDF文本渲染的数学在PDF规范中详尽解释的 ISO 32000-1 。最重要的是8章的图形的和9的文本。

The mechanisms and math of PDF text rendering are exhaustively explained in the PDF specification ISO 32000-1. Most important are chapters 8 Graphics and 9 Text.

从本质上讲,你需要知道当前的图形状态(这应该很容易,因为你毕竟是谁创建的PDF)与您使用的字体的度量标准,然后计算。

Essentially you need to know the current graphic state (which should be easy because you after all are the one who creates the PDF) and the metrics of the font you use and then calculate.

大多数的这些细节都在第9章所描述的运营商和计算管辖,但人们不应该忘记在第8章中描述的当前转换矩阵。

Most of these details are governed by the operators and calculations described in chapter 9 but one should not forget the current transformation matrix described in chapter 8.

这篇关于PDF:我怎么觉得多少空间渲染时将文本占用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆