The Prompt body looks like this (__DATE__ and __TIME__ and so forth get preprocessed into real values): <?xml version="1.0" encoding="UTF-8"?> <BoxPane xmlns:wtkx="http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk" orientation="vertical"> <Label wtkx:id="aboutVersionLabel" text="%aboutVersionLabel" styles="{font:{italic:true, bold:true, size:11}}"/> <Label text="%copyright" styles="{font:{size:11}}"/> <Separator/> <Label text="Built on $(__DATE__) at $(__TIME__)" styles="{font:{size:9}}"/> <Label text="Java version $(__JAVA_VERSION__)" styles="{font:{size:9}}"/> </BoxPane>
The resources for this look like: "copyright": "版权所有(c) 2010安格尔公司", "aboutVersionLabel": "版本%1$s", And the code to do the formatting and everything looks like this: @Override public void aboutRequested() { BoxPane body = (BoxPane)readObject("about", this); aboutVersionLabel.setText(String.format(aboutVersionLabel.getText(), APP_VERSION)); Prompt.prompt(MessageType.INFO, (String)resources.get("mainAppTitle"), body, mainWindow); } It will take me a little bit to try the "Window (maximized)" test you suggested. I will let you know. BTW, the same thing happens with Japanese. I used the same code as in Localization.java because I am also doing the same thing: passing "--language=blah" on the command-line, so I have to dynamically pick a suitable font on the user machine. Roger Whitcomb | Architect, Engineering | roger.whitc...@ingres.com | Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA +1 650-587-5596 | fax: +1 650-587-5550 -----Original Message----- From: Greg Brown [mailto:gkbr...@mac.com] Sent: Tuesday, September 21, 2010 5:43 PM To: dev@pivot.apache.org Subject: Re: Small drawing problem with Chinese-compatible font How are you generating that text? It looks like you are using an a Prompt with a custom body. What does the source code for the body look like? What happens if you place this text in the following hierarchy? Window (maximized)/BoxPane (horizontal)/Label (using Chinese font) FYI, you don't need to programmatically select a compatible font if you already know of one that will work. In that case, you can just call Theme.setFont() directly. On Sep 21, 2010, at 3:43 PM, Roger Whitcomb wrote: > I’m seeing a clipping problem with italic text when using a > Chinese-compatible font. This is 1.5.2 (latest as of today) on Windows XP > SP3: > <image001.png> > > In my application, I basically copied the code for font selection from > “Localization.java” in the Tutorials section: > Theme theme = Theme.getTheme(); > Font font = theme.getFont(); > > // Search for a font that can support the sample string > String sampleResource = resources.getString("mainAppTitle"); > if (font.canDisplayUpTo(sampleResource) != -1) { > Font[] fonts = > GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); > > for (int i = 0; i < fonts.length; i++) { > if (fonts[i].canDisplayUpTo(sampleResource) == -1) { > theme.setFont(fonts[i].deriveFont(Font.PLAIN, 12)); > break; > } > } > } > > So, am I doing something wrong, or is this a bug?? Thanks. > > > Roger Whitcomb > Architect, Engineering > Ingres Corporation > roger.whitc...@ingres.com > > PHONE +1 650.587.5596 > FAX +1 650.587.5550 > > www.ingres.com > > This transmission is confidential and intended solely for the use of the > recipient named above. It may contain confidential, proprietary, or legally > privileged information. If you are not the intended recipient, you are hereby > notified that any unauthorized review, use, disclosure or distribution is > strictly prohibited. If you have received this transmission in error, please > contact the sender by reply e-mail and delete the original transmission and > all copies from your system. >