Phil,
so, correct me if I'm wrong, the TextLayout.draw() rasterizes every single
glyph (and its TextAttributes) to separate images before drawing them to the
Graphics ?
I can understand the complexity behind glyphs, fonts, graphics and text, but
.. is there a specific reason why we need to
Michele Puccini wrote:
Phil,
so, correct me if I'm wrong, the TextLayout.draw() rasterizes every
single
glyph (and its TextAttributes) to separate images before drawing them
to the
Graphics ?
Yes. That's the way almost all font rendering systems work. The separate
images
are a 'glyph cache'
Michele Puccini wrote:
I can understand the complexity behind glyphs, fonts, graphics and
text, but
.. is there a specific reason why we need to align to the pixel grid ?
Maybe
we would get the same features of the Texlayout by rasterizing
outlines and
effects straight to the Graphics and
Thanks Phil,
I did a little mistake: is not a problem of the outline, which is indeed
correct.
Well, a piece of code is worth a thousand words.
The attached sample shows the animated difference between
TextLayout.draw() and g2d.draw(TextLayout.getOutline). Please give it a try
and see what
Michele,
I have not tested your showcase but I think I know what you mean.
Probably the only way to achieve what you want is to implement your own
outline rendering by draw the string five times. Four times using the
foreground color with x, y offsets (1, -1), (1, 1), (-1, 1), (-1, -1),
and
First, its not a bug in TextLayout drawString behaves identically.
You can prove this as follows, instead of your AttributedString use
Font fo = new Font(Serif, Font.PLAIN, 12);
fo = fo.deriveFont(AffineTransform.getScaleInstance(2 +
scale, 3));