TCPDF/PHP和字体:大写数字(下降数字?旧样式?) [英] TCPDF/PHP & Fonts: Uppercase Numbers (Descent numbers? Old style?)

查看:62
本文介绍了TCPDF/PHP和字体:大写数字(下降数字?旧样式?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我给了一种特殊的字体,其编号如下:

I'm given a special font with numbers like that:

例如,您可以在3上看到一些数字下降到基线以下.我想要实现的是,这些数字不会低于该线,并且看起来像这样:

As you can see on the 3 for example, some numbers descent below the baseline. What I like to achieve is, that these numbers don't go below the line and that it looks like this:

在Word中,可以很容易地在字符设置中为同一字体设置此设置.如何在TCPDF中这样渲染数字?我完全呆在那里,不知道如何进行.

In Word this can be easily set in the character settings for the same font. How can one render digits in TCPDF like this? I'm totally stuck there and have no clue how to proceed.

为任何帮助加油!

推荐答案

可以完成,但是很杂乱...原则上,您必须执行以下操作:

It can be done, but it's messy... In principle you'll have to do something like this:

  1. 将您的文本输出分解为从字母到数字的子字符串-可能使用 preg_split() .
  2. 使用 Cell() SetY() .
  3. 输出数字.
  4. 将Y位置重置为第3步之前的位置(假设您还没有越过换行符).
  5. 根据需要重复....

当然,这会提高所有数字的基线-从您的样本中看来,您似乎只需要提高其中一些数字的基线,这将变得更加棘手.

Of course, this raises the baseline for all numbers - from your sample it looks as if you need to raise the baseline for just some of them, which will be even more fiddly.

祝你好运!:-)

这篇关于TCPDF/PHP和字体:大写数字(下降数字?旧样式?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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