classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] text layout implementation


From: graydon hoare
Subject: Re: [PATCH] text layout implementation
Date: 19 Nov 2003 15:38:19 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Sascha Brawer <address@hidden> writes:

> But why do you need to create the string at all? Could't you set up a
> CharacterIterator so it points to a single font run, and use the method
> java.awt.Font.createGlyphVector(FontRenderContext, CharacterIterator)?
> This should be much more efficient, because you'd save all those object
> allocations. A local class could implement CharacterIterator, but also
> have setter methods (or accessible fields), so only a single instance
> needs to be allocated.

ok, changed to do this.

> Also, does the proposed implementation work if there are changes in any
> attributes other than font, such as TextAttribute.UNDERLINE? It seems
> that all these attributes are lost by passing Strings.

well, the CharacterIteratorProxy I've implemented (modified patch
below) doesn't do the whole AttributedCharacterIterator interface, but
there's no method on Font to create a glyph vector with an
AttributedCharacterIterator anyways. I think we'd have to interpret
extra attributes as calls to deriveFont or something, no?

> Please don't feel offended if I'm a bit picky here; I'm just trying to
> ensure that we have efficient and good code.

not at all, this is precisely the sort of polishing that code review
fosters, I'm glad to get the suggestions (as I was, belatedly, with
the graphics2d suggestions).

-graydon

Attachment: j2d-textlayout-fix.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]