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 Struan Judd <st...@sjudd.com> on 2001/08/01 06:51:02 UTC

Fix (not Patch) to changes on 26 July that broke Embedded Font layout

I've tracked down the reason for the problem I reported below.

Unfortunately, I've done this in the pre-codeformat sources and I don't have
access to a patch generator (well maybe but it's a minor fix).

In org.apache.fop.layout.LineArea towards the end of the function:
    private int getWordWidth(String word, boolean doMap)
the line (992 in old code) was changed to be:
        width += getCharWidth(currentChar);

This caused some characters to be mapped twice.

The fix I'm suggesting is to split the function:
    private int getCharWidth(char c)
which begins
        int width = currentFontState.width(currentFontState.mapChar(c));
        if (width <= 0) {
...

into two functions as follows:

    private int getCharWidth(char c) {
        return getMappedCharWidth(currentFontState.mapChar(c));
    }

    private int getMappedCharWidth(char c) {
        int width = currentFontState.width(c);
        if (width <= 0) {
...

and then changed the above mentioned line in getWordWidth() to be:
        width += getMappedCharWidth(currentChar);


I hope this can be checked and committed soon.

TTFN
----
Struan Judd <*> "And so it begins ..."	ICQ: 4498196
http://neongraal.sf.org.nz
mailto:struan@sjudd.com			Voicemail and Fax: +1 (201) 305-1011 x1006


> -----Original Message-----
> From: Struan Judd [mailto:struan@sjudd.com]
> Sent: Friday, 27 July 2001 12:53
> To: fop-dev@xml.apache.org
> Subject: The current CVS version seems to be seriously broken
>
>
> It builds fine but the finally laid out PDF has overlapping areas and
> non-lined up leading edges of table columns.
>
> I am using an embedded font but that's all I can think of that different
> from defaults.
>
> If I checkout as at 25th of July it works fine.
>
> So what's been checked in recently that might affect that.
>
> TTFN
> ----
> Struan Judd <*> "And so it begins ..."	ICQ: 4498196
> http://neongraal.sf.org.nz
> mailto:struan@sjudd.com			Voicemail and Fax:
> +1 (201) 305-1011 x1006
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Fix (not Patch) to changes on 26 July that broke Embedded Font layout

Posted by Tore Engvig <te...@manamind.com>.

You're quite right, the characters was mapped twice.
I removed the boolean doMap argument to getWordWidth because it's not used
anymore. Then we don't need the getMappedCharWidth/getCharWidth
distinction.

Thanks

Tore


On Wed, 1 Aug 2001, Struan Judd wrote:

> I've tracked down the reason for the problem I reported below.
>
> Unfortunately, I've done this in the pre-codeformat sources and I don't have
> access to a patch generator (well maybe but it's a minor fix).
>
> In org.apache.fop.layout.LineArea towards the end of the function:
>     private int getWordWidth(String word, boolean doMap)
> the line (992 in old code) was changed to be:
>         width += getCharWidth(currentChar);
>
> This caused some characters to be mapped twice.
>
> The fix I'm suggesting is to split the function:
>     private int getCharWidth(char c)
> which begins
>         int width = currentFontState.width(currentFontState.mapChar(c));
>         if (width <= 0) {
> ...
>
> into two functions as follows:
>
>     private int getCharWidth(char c) {
>         return getMappedCharWidth(currentFontState.mapChar(c));
>     }
>
>     private int getMappedCharWidth(char c) {
>         int width = currentFontState.width(c);
>         if (width <= 0) {
> ...
>
> and then changed the above mentioned line in getWordWidth() to be:
>         width += getMappedCharWidth(currentChar);
>
>
> I hope this can be checked and committed soon.
>
> TTFN
> ----
> Struan Judd <*> "And so it begins ..."	ICQ: 4498196
> http://neongraal.sf.org.nz
> mailto:struan@sjudd.com			Voicemail and Fax: +1 (201) 305-1011 x1006
>
>
> > -----Original Message-----
> > From: Struan Judd [mailto:struan@sjudd.com]
> > Sent: Friday, 27 July 2001 12:53
> > To: fop-dev@xml.apache.org
> > Subject: The current CVS version seems to be seriously broken
> >
> >
> > It builds fine but the finally laid out PDF has overlapping areas and
> > non-lined up leading edges of table columns.
> >
> > I am using an embedded font but that's all I can think of that different
> > from defaults.
> >
> > If I checkout as at 25th of July it works fine.
> >
> > So what's been checked in recently that might affect that.
> >
> > TTFN
> > ----
> > Struan Judd <*> "And so it begins ..."	ICQ: 4498196
> > http://neongraal.sf.org.nz
> > mailto:struan@sjudd.com			Voicemail and Fax:
> > +1 (201) 305-1011 x1006
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> > For additional commands, email: fop-dev-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org