dongyi6845 2016-05-17 08:57
浏览 73

mPDF Open Sans字体无法呈现一些德语字母

I am trying to generate PDF with the german word "möchte" (the letter is the issue here).. using the font that I added(Open Sans) in /ttfonts folder and set it on config_fonts.php..

"open_sans" => array(
    'B' => "OpenSans-Bold.ttf",
    'BI' => "OpenSans-BoldItalic.ttf",
    'EB' => "OpenSans-ExtraBold.ttf",
    'EBI' => "OpenSans-ExtraBoldItalic.ttf",
    'I' => "OpenSans-Italic.ttf",
    'L' => "OpenSans-Light.ttf",
    'LI' => "OpenSans-LightItalic.ttf",
    'R' => "OpenSans-Regular.ttf",
    'SB' => "OpenSans-Semibold.ttf",
    'SBI' => "OpenSans-SemiboldItalic.ttf",
        'useOTL' => 0xFF,
        'useKashida' => 75,
    )

I also read https://mpdf.github.io/fonts-languages/fonts-in-mpdf-6-x.html and tried modifying config_lang2fonts.php .. I even set it everything to open_sans

$unifont = "open_sans";
return array($coreSuitable ,$unifont);

PS: The font file Open Sans I downloaded is already no subsetting.

But the output is still not like as I expected, it shows: enter image description here

PHP

$mpdf = new mPDF('','A4','','open_sans' , 30 , 12 , 12 , 12 , 10 , 10);

Mark Up

@font-face{
font-family:open_sans;
src: url('mypath/mpdf60/ttfonts/OpenSans-Regular.ttf');
}

I tried using the default fonts of mPDF like dejavusans, It works perfectly. But what I need is Open Sans. Did I miss a configuration in mPDF or what? What is the problem?

  • 写回答

1条回答 默认 最新

  • dsd30433 2016-05-17 22:10
    关注

    The fact that you see a regular o followed by an unknown character strongly suggests the second character is a single non-spacing diaeresis, not available in the font you are using.

    Checking the character sets of DejaVu Sans and Open Sans proves my hunch is right. DejaVu Sans does contain a 'COMBINING DIAERESIS' U+0308: ¨. OpenSans does not.

    Use Unicode Normalization on your input text to replace the sequence o+¨ with its composite character ö U+00F6. The same goes for ä U+00E4 and ü O+00FC.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度