Interesting. This reminds me that quite some time ago I
tried to get the text decoration property flyweighted
(still in the maintenance code), there are only 8 possible
values. Unfortunately, it failed to pay off, apparently
there is no advantage in using a pointer compared to three

I'm sure using the flyweight pattern on font properties could
reduce the memory footprint, the property bundle is large enough,
and documents rarely use more than two dozen or so of
combinations (e.g. two fonts, one a single variant (normal) and
size, the other three variants (normal, bold, italic), the normal
variant in 4 sizes, for a total of 7 different font property
bundles). BorderAndPadding might be another case, for example by
using a static immutable instance for the "empty" case.


Reply via email to