Peter B. West wrote:
I have a requirement for accurate measurement of text to generate a
layout in one part of a work flow, and the rendering of the text in a
later part of the workflow, using the same fonts. For example, I layout
text to be rendered later in PDF.
For this to work, I need to know that the font I specify for the layout
will be the same font used for the rendering. I have to avoid font
substitutions or aggregations that cannot be expected to occur in the
renderers.
Some random observations:
I can get an array of Font[] from the GraphicsEnvironment, but that is
time-consuming, especially if this occurs on a document by document
basis. Can I get a single font that is the same as a particular element
of the array returned by getAllFonts(), by using the fontName returned
from one of the array fonts, via the decode method?
I occasionally see people trying to use Font.decode() where there's really
no need.
If you want to use "Arial" then just do :
Font f = new Font("Arial", Font.PLAIN, 12)" ?
I don't see what's hard about this.
It takes longer to parse the string to decode than to directly create this
object for you and its less error prone.
As I understand it, the fonts returned from gatAllFonts may include
composite fonts.
*WILL* include.
hasUniformLineMetrics will tell me about some aspects
of the consistency of the font If susbstiution have occurred which
happen to share the same height (for LR/RL scripts) characteristics, I
as but will it notify me only about variations in the height (for LR/RL
scripts)?
I can createFont from a font file to which I have access. If I try to
register that font, I may have a name clash with an existing system
font. In fact, if I am picking up a font file from a "known" location,
that is guaranteed, isn't it?
Yep, and API for registering these is new 1.6 functionality anyway
Can I use such an instance of a created font in an attribute map to
getFont(Map)?
Not unless its a non-clashing one that you register
and why are you using getFont instead of the constructor that takes a Map?
Can I further use such a Font instance in deriveFont methods?
Unless registered (via new 1.6 API) Fonts created with createFont can
*ONLY* be used by deriveFont
methods.
What's the best approach?
directly create the font you want :
Font f = new Font("Arial", Font.PLAIN, 12)" ?
-phil.
Thanks
Peter
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".