You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Glenn Adams <gl...@skynav.com> on 2012/04/24 21:16:27 UTC

Re: Chinese PDFs and non embedded fonts

ok, on digging into this further i have found:

(1) luis is correct that embedding is performed by default without the
referenced-fonts element;

(2) in particular, when i add <referenced-fonts><match
font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
not found; when i remove, it works fine (and embeds subset);

(3) looking at TTFFontLoader i find the following:

        boolean isCid = this.embedded;
        if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
            isCid = false;
        }

        if (isCid) {
            multiFont = new MultiByteFont();
            returnFont = multiFont;
            multiFont.setTTCName(ttcFontName);
        } else {
            singleFont = new SingleByteFont();
            returnFont = singleFont;
        }

This code assumes that *all* non-embedded fonts are single byte fonts, so
takes the else clause, constructing a SingleByteFont.

Clearly this code is bogus and needs to use other means to determine if the
font is CID keyed or not. In this case, it is CID keyed, and works fine
when embedded is true.

I will open a bug on this.

Thanks Jean-Philippe for your persistence!

On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:

>
> Just by itself the embed-url attribute does not imply that the font will
> be embedded. I know that the attribute name is confusing, and the
> documentation may not be up to date, but I believe that is the case. Fonts
> are subset embedded by default unless the referenced-fonts element is
> present, in which case they are referenced.
>
>
> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>
>> Hi Glenn,
>>
>> Thanks for your reply.
>>
>> In your example, you are embedding the font:
>>
>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the font
>> embedded.
>>
>> I have no problem creating a chinese PDF when the font is embedded.
>>
>> The issue I am raising is when trying to reference (not embed) the font.
>>
>> Thanks for your help,
>>
>> Best regards,
>> JP
>>
>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>
>>  I just tried this with the font you referenced and had no problem.
>>> Attached is the configuration file and input file I used and resulting
>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>
>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>> notice that I disabled the font cache and placed the font in a "fonts"
>>> subdirectory where I did the test.
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
bug filed at https://issues.apache.org/bugzilla/show_bug.cgi?id=53142

jean-philippe, you may want to create a bugzilla account and add yourself
to the CC list for this bug

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
bug filed at https://issues.apache.org/bugzilla/show_bug.cgi?id=53142

jean-philippe, you may want to create a bugzilla account and add yourself
to the CC list for this bug

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
btw, this code has been present since 2008-05-08 [1]

[1] http://svn.apache.org/viewvc?view=revision&revision=654461

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
btw, this code has been present since 2008-05-08 [1]

[1] http://svn.apache.org/viewvc?view=revision&revision=654461

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>