Skip to main content

[JAVA2D] layoutGlyphVector

1 reply [Last post]
Anonymous

The API docs for java.awt.Font.layoutGlyphVector(...) have a slight bug.
The underlying text reads:
-quote-
Returns a new GlyphVector object, performing full
layout of the text if possible. Full layout is required for
complex text, such as Arabic or Hindi. Support for different
scripts depends on the font and implementation.
Bidi, and should only be performed on text that
has a uniform direction.
-endquote-

This is confusing. It says that layout requires bidi analysis, but then
appears to be saying that if, following this analysis, there is any
mixed bidi text, you can't use layoutGlyphVector. Is this correct? Does
this mean that I must perform the bidi analysis, then iterate through
the paragraph, calling layoutGlyphVector on each of the fragments in turn?

Peter
--
Peter B. West
Folio
---
[This E-mail has been scanned for viruses but it is your responsibility
to maintain up to date anti virus software on the device that you are
currently using to read this email. ]

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Phil Race

1. Yes that's a bad javadoc closing tag placement.

2. What it is trying to say is that if you have text that needs Bidi,
then use the java.text.Bidi analysis to
break it into runs, each of which can then be used with
layoutGlyphVector. This does mean you'd
have multiple GVs you'd have to draw individually.

3. This may seem tricky but 99.99% of apps don't go near here .. it was
only added in 1.4
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4403152
has some background on this relatively recent origin of layoutGlyphVector.

So most apps use drawString will automatically handle Bidi by under the
covers invoking TextLayout.
In fact a lot of typical desktop apps don't even call drawString
directly : they set text on a Component.

-Phil.

Peter B. West wrote:
> The API docs for java.awt.Font.layoutGlyphVector(...) have a slight bug.
> The underlying text reads:
> -quote-
>

Returns a new GlyphVector object, performing full
> layout of the text if possible. Full layout is required for
> complex text, such as Arabic or Hindi. Support for different
> scripts depends on the font and implementation.
>
> Layout requires bidi analysis, as performed by
> >Bidi, and should only be performed on text that
> has a uniform direction.
> -endquote-
>
> This is confusing. It says that layout requires bidi analysis, but then
> appears to be saying that if, following this analysis, there is any
> mixed bidi text, you can't use layoutGlyphVector. Is this correct? Does
> this mean that I must perform the bidi analysis, then iterate through
> the paragraph, calling layoutGlyphVector on each of the fragments in
> turn?
>
> Peter
> --
> Peter B. West
> Folio
> ---
> [This E-mail has been scanned for viruses but it is your responsibility
> to maintain up to date anti virus software on the device that you are
> currently using to read this email. ]
>
> ===========================================================================
>
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> of the message "signoff JAVA2D-INTEREST". For general help, send
> email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".