[reportlab-users] underline and strike parameters (and link regions)
Robin Becker
robin at reportlab.com
Tue Mar 20 06:53:28 EDT 2018
The strike and underline tags currently support no parameters. There is a global setting baseUnderlineProportion which controls
the widths of the lines in proportion to the fontSize, but the offsets colors are not directly controllable. In addition there's
a minor difference in the offset calculation for single and multi fragment lines. A couple of recent bug reports have indicated
some reasons for change in their behaviour.
0) I would like to allow for multiple underlines/strikes in the same region of a paragraph. Double underlining etc etc could then
be done. Additionally we would be able to support underlines of subscripts/superscripts etc etc.
1) I would like to introduce parameters for the strike/u/link tags as follows.
<strike> & <u> would have width, offset and color attributes.
<link> would get uwidth, uoffset & ucolor attributes and a local control for whether underlining is on with an underline attribute.
2) The width and offset parameters can obbiously be either absolute or proportional to some font size. There are several possible
choices of font size to use
<para fontsize="10"> <span size="11">text<u><span size="12">underlined</u>...</span>...<span size="14">....</span>...</para>
a) paragraph level fontSize normally set by the style parameter so 10
b) local fontSize at the point where the tag appears 11.
c) local fontSize at the point where the underline first gets drawn so 12
d) the maximum font size over the line ie 14
Currently we appear to be adhering to the d option for multi fragment lines and the a/b option for single fragment lines.
Given that we already allow suffices for absolute units eg pt, pica, mm, in etc etc it probably makes sense to allow some sort of
suffix to control which proportion we desire to use. For my experiments I am using
a = F
c = f
^ = d
all others are absolute.
I know how to implement b, but I haven't got any idea how to indicate it; I would prefer we use only one local property position
so either at the tag or when the tag gets first used, but others may disagree.
3) The color of lines may either be absolute eg red or perhaps indicated by some special notation to use a default mechanism.
Currently we assume that the line color will be the same as the text colour of the first drawing. There are probably three
sensible relative defaults which could be adopted.
e) paragraph level text color
f) textColor at the point of definition
g) textColor at the point of first use.
how we should indicate that these are to be used I have no idea; suffices won't work.
3) Currently link regions are badly computed and seem to use the maximum font size of the line to get an idea of the clickable
area. They probably ought to use the font height at the point of use for their clickable region.
I would like some ideas on whether any of this sounds reasonable and if there are better ways to indicate defaults etc etc.
--
Robin Becker
More information about the reportlab-users
mailing list