Bug 36036 - [PATCH] Support for font-size=<absolute> and font-size=<relative>
Summary: [PATCH] Support for font-size=<absolute> and font-size=<relative>
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: page-master/layout (show other bugs)
Version: trunk
Hardware: Other other
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-05 05:29 UTC by Manuel Mall
Modified: 2012-04-01 06:26 UTC (History)
0 users



Attachments
The patch (19.17 KB, patch)
2005-08-05 05:30 UTC, Manuel Mall
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Mall 2005-08-05 05:29:41 UTC
Here is a simple patch to add support for absolute and relative font size
specifications. I think the part of the patch for the <absolute> specifications
is OK as is, that is the font sizes are fixed based on a default (=medium) of
12pt and a stepping factor of 1.2 as recommended in the spec. While the spec
allows for the stepping to be font specific at this point in time having a "one
size fits all" approach should do.

I am not so sure about the <relative> part of the patch. The patch simply
translates the "smaller" or "larger" keywords into a percentage. The spec really
asks for mapping into one of the absolute sizes using rounding and if outside
the <absolute> sizes using extrapolation. My understanding of the property
subsystem is not (yet?) good enough to attempt something like that without
guidance / hints from the experienced fop-devs.

The patch also contains updated testcases (with checks :-)).
Comment 1 Manuel Mall 2005-08-05 05:30:12 UTC
Created attachment 15895 [details]
The patch
Comment 2 Chris Bowditch 2005-08-05 12:13:21 UTC
Thanks for doing this. Your patch looks good and appears to work.

However, theres one little thing thats puzzling me. Finn, who is our 
properties guru wrote the class CommonFont. If you look at the method 
getFontState there is some code that implements the relative keywords for font 
weight and comments that say should do font size relative keywords too. Why 
would he write this if all he needed to do was added some keywords to the 
Property Maker ???
Comment 3 Manuel Mall 2005-08-05 12:52:01 UTC
Actually looking at Commonfont.getFontState() the relative font weights are not
(!) implemented (something else to do). One reason Finn couldn't use the same 
scheme I used for font-sizes is that font-weight does not allow percentage 
values. Another reason is, as I pointed out, that my implementation is not 
strictly spec compliant. Both, relative font-weights and relative font-sizes 
must be implement with reference to the parent value. Now if I could figure out 
how this property inheritance / resolution stuff is implemented in Fop, i.e. 
how / where / when I can get to the value of the property in the parent 
element, I could fix both of these relative properties (and may be some of the 
other percentage stuff not working).
Comment 4 Chris Bowditch 2005-08-05 13:32:53 UTC
Yes you are right that getFontState() method isn't doing a great deal and as 
you say this is because the percentage should apply to the parent.

I have applied your patch but decided to leave the bodge for relative sizes 
out for now. There's already a task item to properly implement percentages 
within FOP's property/FO sub systems. So I think this is best addressed after 
that work is completed.

Thanks for your contribution
Comment 5 Glenn Adams 2012-04-01 06:26:05 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed