Questions about AWTRenderer
Hi, all I have the some questions about FOP AWTRenderer: 1) What reasons to some Graphics2D rendering hints are not turned on by defaults? I mean the KEY_ANTIALIASING and KEY_FRACTIONALMETRICS. I have tried to turn them on and IMHO, FO looking is being pretty attractive and accurate. I believe what it could be the potential performance problem for the slow machines (or, maybe, some videocards), but we could make it possible to enabling/disabling by user (by the properties files or somehow else). But maybe there is a global Java2D properties somewhere? Then sorry, but I didnt find them... 2) I use the AWTRenderer in my own program for previewing the results before PDF generation or printing. Therefore, I want to have the precise snapshot of the future PDF. But it seems what AWT and AcroRead interpretes the font metrics differently, thus AWT preview doesnt looks like the PDF (or printed hardcopy). There is a differences between the linebreaks and pagebreaks locations, tables geometry etc. I have no ideas about how I can to make the precise preview, but maybe someone has? 3) What about wrapping AWTRenderer as the swing JComponent? It could be a more convenience to embedding it in applications. Thanks and sorry for my english, its ugly, I know. Best regards, Alex V. Alishevskikh [EMAIL PROTECTED] OpenMechanics http://www.openmechanics.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: AWTRenderer L10N issues
Hi, Patrick, I only regret that using this new getResourceBundle, it looks like the standard getBundle search algorithm is not implemented. I personnaly believe it is usually bad design to hardcode a default language, One should rather use a Locale for setting the language (picked from the argv for instance) or getting the platform's default one and rely on the getBundle algorithm. The default resource language could then become the platform's language (locale) unless no resource exist for it, in which case the resources found in the base resource bundle could be used (this could be a different file for each system according to installation option). I agree. This is better than my proposals. Ive found the old message from Satoshi Ishigami, Jan 28, 2002 (see below) and he says the same. Satoshi wrote: The language to use on AWTViewer is decided by getting the system default or specifying -l option. The decided language is used for the suffix of resource files. However Java has a feature that access to a resource file for every language by default (i.e. java.util.ResourceBundle class and for examples rsources_ja.properties). Also I've understood why the resources.ru file was in that strange encoding. Satoshi wrote: I also convert all existed resource file for AWTViewer from iso-8859-1 to UTF-8 automatically. resources.ru was in the iso-8859-5 (as you says), not in the iso-8859-1. And it was converted to UTF-8, supposed what the primary encoding is 8859-1. Because of this I saw the european additional letters (from 8859-1) instead of cyrillic. It could happened with every 8859-x (not -1) encoded resource, if it was presents there. The full text of Satoshi Ishigami message: - Original Message - From: Satoshi Ishigami [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 28, 2002 4:32 AM Subject: i18n in awt viewer [PATCH] Hi all ! For AWTViewer i18n, I hacked the AWTViewer for FOP-0.23.0rc maintenance release and I had some questions. I tried to show the menu as Japanese text for i18n for trial. I wrote the resource files by UTF-8 encoding because it is not possible to map multi-bytes characters by iso-8859-1 encoding. I also convert all existed resource file for AWTViewer from iso-8859-1 to UTF-8 automatically. I modified some source files associated with AWTViewer, too. This modification is for the message i18n and for additional fonts support on AWTViewer. The additional fonts are specified in a userconfig.xml file. And you may start FOP with -c and -awt options. NOTE:Now the additional fonts that you can specified is only TrueType font (.ttf and .ttc). This restriction comes from the feature of SUN's JDK (see java.awt.Font javadoc). 1) If you specify the embed-file attribute in userconfig.xml and use JDK1.3 or higher, the specified TrueType font is loaded and used in AWTViewer. 2) Otherwise, if you don't specify the embed-file attribute or use JDK1.2, the additional font is regarded as Java's Dialog logical font name for each Locale. I attempt to show Japanese fo file. My test environment is: SUN's JDK1.2.2 and JDK1.3. LANG=EN and JA environment variable. When use LANG=JA, 1) and 2) are works fine (menu is Japanese text and the represented document is readable). LANG=EN and 1) also works fine (menu is English text and document readable). But the convination of LANG=EN and 2) does not works fine (menu looks English text well but document is unreadble). However I think that this behavior is right. Below is my questions. Currently the text of menu for the AWTViewer is loaded from org.apache.fop.viewer.resources package. The AWTViewer needs two kinds of resource file (messages.lang and resources.lang). I can not found messages.lang file for some languages (fi,fr, it,pl.ru). Therefore the following command can not start the AWTViewer (thrown NPE). fop -awt -l fi foo.fo Q1.Is not messages.lang file necessary with resources.lang file? The language to use on AWTViewer is decided by getting the system default or specifying -l option. The decided language is used for the suffix of resource files. However Java has a feature that access to a resource file for every language by default (i.e. java.util.ResourceBundle class and for examples rsources_ja.properties). Currently AWTViewer regards resource files as written by iso-8859-1 encoding. This is not good for i18n. I converted them to UTF-8 encoding, but I think that the ResourceBundle framework is better than now because AWTViewer can start even if there are not resource files for any languages. Q2.Why AWTViewer does not use ResourceBundle? Best Regards. --- $B@P?@(B $B3P;J(B(Satoshi Ishigami) VIC TOKAI CORPORATION - Original Message - From: Patrick Andries To: [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 6:09 PM Subject: Re: AWTRenderer L10N issues Alex V. Alishevskikh wrote: Hi, Patrick,You wrote: No, it was coded in 8859-5
Re: AWTRenderer L10N issues
Hi, Patrick, You wrote: No, it was coded in 8859-5 (Cyrillic) or Windows 1251, AFAIK, ISO8859-5 is not the same that Windows 1251. I see the extended latin letters (with umlauts etc) instead of cyrillic characters. I've compiled FOP on machine (WinXP, Sun JDK 1.3) with russian locale. ? The only encoding that Properties and PropertyResourceBundle understand is ISO 8859-1 with Unicode escapes. This is not UTF-8. But why my Properties encoded as UTF-8 works and I see the readable russian text? - Original Message - From: Patrick Andries [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 24, 2002 9:59 AM Subject: Re: AWTRenderer L10N issues Christian Geisert wrote: Alex V. Alishevskikh wrote: Hi, there, I've found what messages.ru file is missing in the AWT Renderer resources. As a result, AWTStarter crashes with NullPointerException on launching it on russian system. The another issue is wrong encoding in resources.ru file (it looks like 8859-1 ), what makes the cyrillic labels and menus are unreadable. No, it was coded in 8859-5 (Cyrillic) or Windows 1251, I can see File=fail æÁÊÌ. You most probably compiled on a non-Cyrillic machine and did not set -encoding javac compilation option. I believe your change is, however, a good one. I notice you also change some translations.(About, Show, etc.). . I've created the messages.ru and resources.ru files with russian text in UTF-8 (see attached files). It seems what it works well (FOP 0.20.3, Sun JDK 1.3.0). Did you use Unicode escape sequences (with native2ascii) ? If not, I'm not sure it works all the time (might because of BOM). ? The only encoding that Properties and PropertyResourceBundle understand is ISO 8859-1 with Unicode escapes. This is not UTF-8. UTF-8 encodes Unicode characters into sequences of 1 to 4 bytes using a mapping specified in The Unicode Standard, version 2.0 or 3.0. Other encodings need to be converted with the native2ascii tool. This applies to all releases from 1.1 to 1.3. ? http://www.sun.com/developers/gadc/faq/java/files/properties.html#2.0 I wish to propose the solution for case when AWTStarter cannot finds the resource bundle appropriated for user language: then let it to use the english (*.en) resources as default. [..] It should prevent the crashes on machines with language settings are unsupported in AWT renderer resources. Any opinions? I wonder if this is a good idea. Why not use whatever is in the default resourceBundle ? Hardcoding seems useless at best when there is a more flexible built-in mechanism (getBundle search). However, it looks like this mechanism is short-circuited in AWTStarter by using a ResourceBundle name that incorporates the language ( resource = getResourceBundle(TRANSLATION_PATH + resources. + language)) and does not set any Locale. I do not believe this to be wise. This is an i18n issue. P. Andries --- Tout Unicode 3.1 en franc,ais http://hapax.iquebec.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
AWTRenderer L10N issues
Hi, there, I've found what "messages.ru" file is missing in the AWT Renderer resources. As a result, AWTStarter crashes with NullPointerException on launching it on russian system. The another issue is wrong encoding in "resources.ru" file (it looks like 8859-1), what makes the cyrillic labels and menus are unreadable. I've created the messages.ru and resources.ru files with russian text in UTF-8 (see attached files). It seems what it works well (FOP 0.20.3, Sun JDK 1.3.0). I wish to propose the solution for case when AWTStarter cannot finds the resource bundle appropriated for user language: then let it to use the english (*.en) resources as default.It would be look like as:(at org.apache.fop.apps.AWTStarter.getResourceBundle() ) ... URL url = getClass().getResource(path);if (url == null) {path = path.substring(0, path.lastIndexOf(".")) + ".en";url = getClass().getResource(path);}in = url.openStream();... (See attached AWTStarter.java) It should prevent the crashes on machines with language settings are unsupported in AWT renderer resources. Any opinions? Best regards,Alex V. Alishevskikh [EMAIL PROTECTED] OpenMechanicshttp://www.openmechanics.net resources.ru Description: Binary data messages.ru Description: Binary data AWTStarter.java Description: Binary data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Unknown error and hangs at FOP 0.20.2RC
Hi, all When I moved from 0.20.1 to 0.20.2RC, I've met a strange behavior of FOP with embedded fonts: [DEBUG]: Input mode: [DEBUG]: FO [DEBUG]: fo input file: howto.fo[DEBUG]: Output mode: [DEBUG]: pdf[DEBUG]: output file: howto.pdf[DEBUG]: OPTIONS[DEBUG]: user configuration file: c:\java\app\fop\conf\userconfig.xml[DEBUG]: debug mode on[DEBUG]: dump configuration[DEBUG]: quiet mode on[DEBUG]: reading user configuration file[DEBUG]: base directory: file:/C:/DocFactory/[INFO]: FOP 0.20.2[DEBUG]: using SAX parser org.apache.xerces.parsers.SAXParser[INFO]: building formatting object tree[DEBUG]: setting up fonts[INFO]: [1][ERROR]: [ERROR]: [ERROR]: [ERROR]: [ERROR]: And so on indefinitely, until the ctrl+break striked. I get no any exceptions, and no other error messages. When I use the native fonts (not embedded), it seems what everything is OK.I am a little surprised, because previous FOP versions (0.19 and 0.20.1) works succesfully with a same my FO files and fonts embedded. Im using a 0.20.2RC, Sun JDK 1.3.0 on WinXP and Monotype Arial and TimesNR opentype fonts embedded.FO-Files encoded as UTF-8 (contains cyrillic characters). Sorry if this is a known issue, but recently I can't to check out this list regularly :-( P.S. A little request for commiters:I am developer of the russian hyphenations for FOP (ru.xml).óould someone replace my former corporate e-mail "[EMAIL PROTECTED]" to "[EMAIL PROTECTED]" in "ru.xml" file and CVS info, please?My apologies for bothering. Thanks. Best regards,Alex V. Alishevskikh [EMAIL PROTECTED] OpenMechanicshttp://www.openmechanics.net
Leaders with non-fixed length doesnt shown at FOP 0.20
Hi, there, I tried to build the TOC with leaders without leader-length specification (i.e. must to expands to entire available space between item text and page number), like as: fo:block fo:basic-link internal-destination="part0"Introduction/fo:basic-link fo:leader leader-alignment="reference-area" leader-pattern="dots"/ fo:page-number-citation ref-id="part0" text-align="end"/ /fo:block(See my XSL-FO example file) This is working succesfully at FOP 0.19 (see leaders_at_FOP019.pdf), but at FOP 0.20.1 leaders doesnt appears (like as zero length)(see leaders_at_FOP0201.pdf). Is this a FOP bug? Else, is this a wrong way to do so? I unlike to specify fixed leader-length or use the tables with fixed columns width, because I need the expansible leaders in TOC items. I use FOP-0.19 (CVS build 20010424105603) and FOP 0.20.1 release. Thanks and good work. Best regards,Alex V. Alishevskikh [EMAIL PROTECTED] OpenMechanics http://openmechanics.net leaders_test.fo leaders_at_FOP0201.pdf leaders_at_FOP019.pdf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]