RE: How to prevent hyphenation after hyphens?
Thanks Eric How to insert non-breaking hyphen properly? I change content to fo:block margin-right=120pt border-width=1pt border-color=black border-style=solid firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second /fo:block and I get next result http://old.nabble.com/file/p34004367/%2523.png Why is '#' inserted? Amick, Eric wrote: Hyphenation means adding a hyphen to text, so the hyphenate property won't help. Most likely your best bet is changing the hyphens in the text to non-breaking hyphens (Unicode U+2011), presumably in the style sheet if you're using one. If that doesn't work, you can try wrapping each word in an fo:inline with keep-together.within-line=always. Eric Amick Systems Engineer II Legislative Computer Systems -Original Message- From: SNawa [mailto:navat...@gmail.com] Sent: Tuesday, June 12, 2012 12:29 To: fop-users@xmlgraphics.apache.org Subject: How to prevent hyphenation after hyphens? Hi all I have content with hyphens fo:block margin-right=120pt border-width=1pt border-color=black border-style=solid hyphenate=false first-second first-second first-second first-second first- second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second /fo:block Output looks like http://old.nabble.com/file/p34000343/hyphens.png How to prevent hyphenation after hyphens? I want that the first and second words stay in the same line Thanks -- View this message in context: http://old.nabble.com/How-to-prevent- hyphenation-after-hyphens--tp34000343p34000343.html Sent from the FOP - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org -- View this message in context: http://old.nabble.com/How-to-prevent-hyphenation-after-hyphens--tp34000343p34004367.html Sent from the FOP - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
Re: How to prevent hyphenation after hyphens?
Hi, The '#' means that the character is not found in the used font. You have here 2 alternatives: - either use a font that contains such character (tried successfully with DejaVu collection, follow [1]) - or (as said Eric) use keep-together.within-line on 1 fo:inline for each first-second. [1] http://dejavu-fonts.org/wiki/Main_Page 2012/6/13 SNawa navat...@gmail.com: Thanks Eric How to insert non-breaking hyphen properly? I change content to fo:block margin-right=120pt border-width=1pt border-color=black border-style=solid firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second firstamp;#x2011;second /fo:block and I get next result http://old.nabble.com/file/p34004367/%2523.png Why is '#' inserted? Amick, Eric wrote: Hyphenation means adding a hyphen to text, so the hyphenate property won't help. Most likely your best bet is changing the hyphens in the text to non-breaking hyphens (Unicode U+2011), presumably in the style sheet if you're using one. If that doesn't work, you can try wrapping each word in an fo:inline with keep-together.within-line=always. Eric Amick Systems Engineer II Legislative Computer Systems -Original Message- From: SNawa [mailto:navat...@gmail.com] Sent: Tuesday, June 12, 2012 12:29 Hi all I have content with hyphens fo:block margin-right=120pt border-width=1pt border-color=black border-style=solid hyphenate=false first-second first-second first-second first-second first- second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second first-second /fo:block Output looks like http://old.nabble.com/file/p34000343/hyphens.png How to prevent hyphenation after hyphens? I want that the first and second words stay in the same line Thanks -- pascal - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
RE: Still having trouble loading fonts at runtime - suggestions?
Hi Bernard Thanks for that code - that's really helpful. However, from what I can tell (java isn't one of my main languages, I'm a Python dev) it seems as though it doesn't actually tell FOP to reload any fonts, but rather gathers a list of fonts and then asks `PropertiesManager` to set the fonts. I can't see a reference to `PropertiesManager` in the FOP docs; is that a class in your app, or am I missing something? Cheers, Phill Bernmeister wrote: Hi Phillip, I have written a desktop application which, on start up, refreshes a cache of fonts (using FOP code) and subsequently allows the user to refresh that cache by hitting a button (again, calls the same FOP code). See attached. When the application starts up I call FOPManager.refreshFonts( false ); Before allowing the user to initiate a print, I call FOPManager.isReady() When the user forces a cache update, I call FOPManager.refreshFonts( true ); My fopConfiguration.xml is standard and doesn't do anything fancy. Cheers, Bernard. -- View this message in context: http://old.nabble.com/Still-having-trouble-loading-fonts-at-runtime---suggestions--tp34000790p34005767.html Sent from the FOP - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
RE: Still having trouble loading fonts at runtime - suggestions?
Hi Phill, The PropertiesManager is a class of mine which basically extends java.util.Properties and essentially reads/writes a hash table of key/value pairs. I store in the properties a list of the font names and their respective font files (as discovered via FOP). For me on Ubuntu 12.04 I get: FontList=Andale Mono,Arial,Arial Black,Bitstream Charter,Century Schoolbook L,Comic Sans MS,Courier,...FontFiles=file\:/usr/share/fonts/truetype/openoffice/opens___.ttf,file\:/usr/share/fonts/truetype/ttf-khmeros-core/KhmerOS.ttf,... I cannot remember precisely why I had to implement this cache but I think it had to do with supporting i18n. Originally I simply used the hard coded default fonts which FOP provided but I found on some non-English machines I'd get the 'square' symbol and so wanted to provide a way for a user to specify a font to use for the render. To do this I got FOP to tell me what fonts were available and present that to the user. I just cache that information so I don't have to ask FOP each time (which can take a few minutes). When I do the render I pass the font name as one of the transformer parameters: xslParams.put( font-family, (String)m_fontName.getSelectedItem() ); where m_fontName is the selected font name in the JComboBox shown to the user. Cheers, Bernard. Date: Wed, 13 Jun 2012 06:41:58 -0700 From: phillip.old...@gmail.com To: fop-users@xmlgraphics.apache.org Subject: RE: Still having trouble loading fonts at runtime - suggestions? Hi Bernard Thanks for that code - that's really helpful. However, from what I can tell (java isn't one of my main languages, I'm a Python dev) it seems as though it doesn't actually tell FOP to reload any fonts, but rather gathers a list of fonts and then asks `PropertiesManager` to set the fonts. I can't see a reference to `PropertiesManager` in the FOP docs; is that a class in your app, or am I missing something? Cheers, Phill
RE: Still having trouble loading fonts at runtime - suggestions?
Hi Phill, I make a call to FOP itself to find the fonts - see FOPManager::InitialiseFonts in the code from my first reply. The magic line is SortedMap?,? fontFamilies = new FontListGenerator().listFonts( ms_fopFactory, org.apache.xmlgraphics.util.MimeConstants.MIME_PDF, fontEventListener ); I've looked at the FOP internal code and they simply squirrel through various directories, based on the current OS, to find font files. I call this code and then simply cache that information. I suspect to add a font in at runtime you'd need to configure that in the FOP configuration file - never had to do this myself. Cheers, Bernard. Date: Wed, 13 Jun 2012 07:20:46 -0700 From: phillip.old...@gmail.com To: fop-users@xmlgraphics.apache.org Subject: RE: Still having trouble loading fonts at runtime - suggestions? Hi Bernard Thanks for that explanation; that makes a lot of sense now. I think I'm still having a little trouble working out which are the line(s) where you're telling FOP which fonts are available, though. Specifically what I have is a byte-array containing a font's data, and I need to make FOP use that font when it renders an FO (there's no XSL translation - that has already been done). I've been through the docs a number of times now, but I can't see where I can add a font manually to FOP's runtime config, or tell it to refresh it's font cache after providing a directory of fonts, or anything like that. :(