Forum Bugs

warning: font has no family name

42thcoder
Hey, thank you for your awesome tool.

I got a simple HTML which use @font-face looks like this:

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <style>
        @page {
            prince-shrink-to-fit: auto
        }

        @font-face {
            font-family: 'zao zi gong fang fang hei';
            src: url('https://f2e-asset.huo365.cn/uploads/fonts/MF_FangHei__Noncommercial_.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }

        @font-face {
            font-family: 'fang zheng lv jian';
            src: url('https://f2e-asset.huo365.cn/uploads/fonts/fang_zheng_lv_jian_de_zi_ti_jian_ti_1508307216.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }
    </style>
</head>
<body>

<div style="font-family: 'fang zheng lv jian';">
你好
</div>

<div style="font-family: 'zao zi gong fang fang hei';">
八哥
</div>

</body>
</html>





"zao zi gong fang fang hei" is normal, however "zao zi gong fang fang hei" has a warning, which is : "prince: https://f2e-asset.huo365.cn/uploads/fonts/fang_zheng_lv_jian_de_zi_ti_jian_ti_1508307216.ttf: warning: font has no family name"

And the PDF I got, the text in the second div is question mark.
mikeday
We will take a look at this font.
mikeday
Prince attempts to retrieve the font family name from the OpenType name table, however this font has a number of names which claim to be Roman/English, but contain bytes outside the ASCII character set which I suspect are for Chinese text. This makes it difficult to retrieve the correct name to embed in the PDF file.
42thcoder
How can I change OpenType name table?

I have tried use some tools to change name and I failed. It did not work as I expected.

Edited by 42thcoder

mikeday
I think we may be able to support this font, although it shows up simply as "-Regular" as it has no PostScript name. We will investigate further.
mikeday
Okay it does have a PostScript name, but the name is literally "-Regular", and the descriptive font name claims to be in English but is actually in Chinese, so whichever program created this font was not very careful. However, it looks like we can actually process it:
/* 方正吕建德字体, Regular */
@font-face {
    font-family: "方正吕建德字体";
    font-weight: normal;
    font-style: normal;
    font-stretch: normal;
    src: url("fang_zheng_lv_jian_de_zi_ti_jian_ti_1508307216.ttf")
}

We will include this change in the next build of Prince.
42thcoder
Thanks for your kindly reply.

So, what can I do right now to fix this problem? Or I shall wait until next build of Prince. BTW, when will you guys release next build of Prince
mikeday
Which operating system are you running Prince on?
42thcoder
Ubuntu 16.04
mikeday
I have updated the latest builds for Ubuntu 16.04 to fix the problem, please let me know how it goes.
42thcoder
mikeday
Are you getting the same error as before if you run "prince --scanfonts *.ttf" ?

(Also please check "prince --version" just to make sure it is running the correct one).
42thcoder
prince --scanfonts https://f2e-asset.huo365.cn/uploads/fonts/shu_ti_fang_zhuo_xiao_feng_xing_cao_ti_1510293876.ttf

prince: https://f2e-asset.huo365.cn/uploads/fonts/shu_ti_fang_zhuo_xiao_feng_xing_cao_ti_1510293876.ttf: error: font has no family name


prince --version
Prince 11.3
Copyright 2002-2017 YesLogic Pty. Ltd.


mikeday
It's still Prince 11.3, perhaps the DEB did not install correctly?
42thcoder
It is working now.

[ rm /usr/local/bin/prince ] is necessary to update prince.

Thanks man!