Small-Caps support in FOP 0.95

View: New views
4 Messages — Rating Filter:   Alert me  

Small-Caps support in FOP 0.95

by nancy_b :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

My environment: Docbook stylesheets, XSLTPROC, FOP 0.95
I would like to produce some headings in allcaps. So I've added the following in my customization layer:
<xsl:template match="emphasis[@role = 'smallcaps']">
<fo:inline font-variant="small-caps">
  <xsl:apply-templates/>
</fo:inline>
</xsl:template>

In my source file I entered:
<emphasis role="smallcaps">Example</emphasis>

After compiling a PDF, guess what happened? Nothing :-(

Do you have any idea how to solve this, folks?

Thanks a lot in advance!!!

Re: Small-Caps support in FOP 0.95

by Vincent Hennebert-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nancy,

nancy_b wrote:

> Hi all,
>
> My environment: Docbook stylesheets, XSLTPROC, FOP 0.95
> I would like to produce some headings in allcaps. So I've added the
> following in my customization layer:
> <xsl:template match="emphasis[@role = 'smallcaps']">
> <fo:inline font-variant="small-caps">
>   <xsl:apply-templates/>
> </fo:inline>
> </xsl:template>
>
> In my source file I entered:
> <emphasis role="smallcaps">Example</emphasis>
>
> After compiling a PDF, guess what happened? Nothing :-(

The font-variant property is not supported by FOP. All you can do is
implement tricks to work around that missing feature.

You could fake small capitals by transforming the piece of text into
capitals and reducing the font size to, e.g., 70%:
    <fo:block>E<fo:inline font-size="70%">XAMPLE</fo:inline>...</fo:block>
Probably the easiest, but the result will look ugly.

If you know which font you are going to use, know that that font has
glyphs for small capitals, know the Unicode code points of those
glyphs, then you could replace every letter with the appropriate
codepoint and you will get the true small capitals. Much less easy, but
the result will look good.

For example, the Junicode font [1] has glyphs for small capitals. Those
glyphs are stored in the ‘Private Use Area’ range of the Unicode
standard, from U+F761 to U+F77A (non-accented versions only...). So you
would have to produce the following:
    <fo:block
font-family="Junicode">E
    and the rest of the text...</fo:block>

Who said cryptic? :-)

This is more or less how the font-variant property would work.

[1] http://junicode.sourceforge.net/


> Do you have any idea how to solve this, folks?
>
> Thanks a lot in advance!!!


HTH,
Vincent

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@...
For additional commands, e-mail: fop-users-help@...


Re: Small-Caps support in FOP 0.95

by nancy_b :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Vincent,

First of all, thanks a lot for your response! I was extremely surprised to discover that such a basic functionality as smallcaps is unsupported. Is there any intention to add support for this feature in the next FOP version?

My best wishes,
Nancy

Vincent Hennebert-2 wrote:
Hi Nancy,

nancy_b wrote:
> Hi all,
>
> My environment: Docbook stylesheets, XSLTPROC, FOP 0.95
> I would like to produce some headings in allcaps. So I've added the
> following in my customization layer:
> <xsl:template match="emphasis[@role = 'smallcaps']">
> <fo:inline font-variant="small-caps">
>   <xsl:apply-templates/>
> </fo:inline>
> </xsl:template>
>
> In my source file I entered:
> <emphasis role="smallcaps">Example</emphasis>
>
> After compiling a PDF, guess what happened? Nothing :-(

The font-variant property is not supported by FOP. All you can do is
implement tricks to work around that missing feature.

You could fake small capitals by transforming the piece of text into
capitals and reducing the font size to, e.g., 70%:
    <fo:block>E<fo:inline font-size="70%">XAMPLE</fo:inline>...</fo:block>
Probably the easiest, but the result will look ugly.

If you know which font you are going to use, know that that font has
glyphs for small capitals, know the Unicode code points of those
glyphs, then you could replace every letter with the appropriate
codepoint and you will get the true small capitals. Much less easy, but
the result will look good.

For example, the Junicode font [1] has glyphs for small capitals. Those
glyphs are stored in the ‘Private Use Area’ range of the Unicode
standard, from U+F761 to U+F77A (non-accented versions only...). So you
would have to produce the following:
    <fo:block
font-family="Junicode">E
    and the rest of the text...</fo:block>

Who said cryptic? :-)

This is more or less how the font-variant property would work.

[1] http://junicode.sourceforge.net/


> Do you have any idea how to solve this, folks?
>
> Thanks a lot in advance!!!


HTH,
Vincent

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

Re: Small-Caps support in FOP 0.95

by Vincent Hennebert-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nancy,

nancy_b wrote:
> Hi Vincent,
>
> First of all, thanks a lot for your response! I was extremely surprised to
> discover that such a basic functionality as smallcaps is unsupported. Is
> there any intention to add support for this feature in the next FOP version?

Not to my knowledge. And it’s not as basic a functionality as you may
think :-) This requires to look in the font file if glyphs are available
for the small-caps variant. The OpenType font format provides this
functionality, but I’m not sure about the others (TrueType, Type1). And
FOP’s font library needs to be taught how to get that information.


Vincent


> My best wishes,
> Nancy
>
>
> Vincent Hennebert-2 wrote:
>> Hi Nancy,
>>
>> nancy_b wrote:
>>> Hi all,
>>>
>>> My environment: Docbook stylesheets, XSLTPROC, FOP 0.95
>>> I would like to produce some headings in allcaps. So I've added the
>>> following in my customization layer:
>>> <xsl:template match="emphasis[@role = 'smallcaps']">
>>> <fo:inline font-variant="small-caps">
>>>   <xsl:apply-templates/>
>>> </fo:inline>
>>> </xsl:template>
>>>
>>> In my source file I entered:
>>> <emphasis role="smallcaps">Example</emphasis>
>>>
>>> After compiling a PDF, guess what happened? Nothing :-(
>> The font-variant property is not supported by FOP. All you can do is
>> implement tricks to work around that missing feature.
>>
>> You could fake small capitals by transforming the piece of text into
>> capitals and reducing the font size to, e.g., 70%:
>>     <fo:block>E<fo:inline font-size="70%">XAMPLE</fo:inline>...</fo:block>
>> Probably the easiest, but the result will look ugly.
>>
>> If you know which font you are going to use, know that that font has
>> glyphs for small capitals, know the Unicode code points of those
>> glyphs, then you could replace every letter with the appropriate
>> codepoint and you will get the true small capitals. Much less easy, but
>> the result will look good.
>>
>> For example, the Junicode font [1] has glyphs for small capitals. Those
>> glyphs are stored in the ‘Private Use Area’ range of the Unicode
>> standard, from U+F761 to U+F77A (non-accented versions only...). So you
>> would have to produce the following:
>>     <fo:block
>> font-family="Junicode">E
>>     and the rest of the text...</fo:block>
>>
>> Who said cryptic? :-)
>>
>> This is more or less how the font-variant property would work.
>>
>> [1] http://junicode.sourceforge.net/
>>
>>
>>> Do you have any idea how to solve this, folks?
>>>
>>> Thanks a lot in advance!!!
>>
>> HTH,
>> Vincent

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@...
For additional commands, e-mail: fop-users-help@...