I am using Pentaho Report Designer 3.8.3 and I have small, aesthetic problem with fonts.
I have implemented, or better say, I am aimplementing OpenSans font into my pentaho.
Its cirrent state is, that i have installed this font into Linux(which is my pentaho runing on) and also into java. But i still have 2 problems with fonts:
1.) I see OpenSans font in html only when i open it on PC where it actually is installed. Whenever i open report with openSans font on machine where it is not installed, it change it for something else, Arial for example.
(I have added OpenSans to: '/usr/lib/jvm/' and also into: '/usr/share/fonts')
2.) After publishing report to PDF, I see only '?' instead of accentuated characters. But in html, I see no '?', each letter is as it should be.
(I have added
org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.Encoding=ISO 639-1 #my language code, Slovak
into '/home/pentaho/pentaho/biserver-ce/tomcat/webapps/pentaho/WEB-INF/classes/classic-engine.properties' file)
Does anyone have an idea wht else should I try to make it work properly?
I'm not sure what you can do with html export other than doing the usual approach of setting the font-family so it has something to fall back to.
However in PDF look carefully at the pdf export options, you'll see there's a "embed fonts" option. Enable that and your pdf will work anywhere!
Related
I am building an Excel file with Apache POI. After I add all of the content I autosize the columns using sheet.autoSizeColumn(i).
Sometimes it doesn't quite give enough space. I have tried Verdana and Calibri-Regular (had to switch to Calibri-Regular from Calibri because the autosize was going completely crazy all of a sudden on our Windows 7 boxes but worked fine on our Linux boxes, which is a mystery to me). Is there something I can do to fix this? Or is there a way to add a little padding after autosizing?
Edit:
On my Windows dev box I tried setting the font to Verdana with font.setFontName("Verdana"). All of the content definitely changes to Verdana and the sizing on the columns is perfect. On the Linux production box I used the bit of Java code that Gagravarr referenced in the below comments to print out a list of the fonts that Java sees. I tried Monospaced but the spacing was identical to the above screenshot. I then tried Dingbats and the content was still readable (which it shouldn't have been) while the spacing was really off (see screenshot below).
Also openjdk and Oracle JDK do not use the same font engine (SUN∕Oracle kept its legacy engine for fear any change would break badly coded apps). It's quite possible openjdk will work better on linux for font stuff, since it reuses the same font libraries as the rest of the system, instead of reinventing a square wheel.
Fonts are a legal nightmare; Linux fonts licensing is usually liberal enough you can copy, modify and deploy them anywhere but the reverse is not true (Microsoft was very careful to create vendor lock-in for anyone foolish enough to build apps depending on Windows fonts)
I am not sure whether this will resolve your problem or not, but if you have asked about "is there a way to add a little padding after autosizing?".... yes you can do it by following way.
testSheet.autoSizeColumn(ColIndex);
testSheet.setColumnWidth(ColIndex ,testSheet.getColumnWidth(ColIndex)+PaddingWidth);
I'm writing an application that reads a text file containing a list of vocabulary words in both English and Chinese. These are then displayed in a JTable. When I run or debug the app in Eclipse, everything displays fine. I can see and read the characters and the English. However, when I execute the app from the command line or from an executable jar, it's all wrong. The characters show up as either squares or as gibberish.
I also have a text box that when I type Chinese into it, it displays correctly.
My first thought was that it was a font problem. I was using a font installed on my system. Since I can't guarantee that the person using this app will have that font, I moved it to a resource folder and load the font from a file. The font appears as though it's been loaded so I'm convinced it's not a font issue.
I found another question that suggested using -Dfile.encoding=utf-8. I've tried this and it did not work.
Would the brilliant folks at Stack Overflow have any advice on how to make this work?
I'm writing this on a non-chinese version of Windows.
Well then you won't ever be able to get a Java program to produce Chinese command-line output.
Java, like almost all languages, uses the C standard library which has byte-based IO. The Windows command prompt interprets byte-based IO using the locale-specific default code page. That's never a UTF, so Unicode characters outside of the current locale's default code page just won't work.
(In theory you should be able to get it to work by changing your console fonts and using chcp 65001 (UTF-8) together with -Dfile.encoding=UTF-8, but in practice it doesn't work reliably due to bugs in the C runtime. Unicode on the command prompt is a long-standing sore point.)
I'm generating a pdf report with Jasper Reports 3.1.2. I have a multi line text field that contains several lines: this field is split over 2 consecutive pages.
The problem is that on AiX and Linux systems the last line in the first page is always missing (on Windows systems everything is fine). I've tried modifying margins, sizes and fonts but nothing happens: the last line of the first page is always missing
Any idea?
Thanks in advance
What font are you using? Problems like this are usually† caused by fonts not being available. Use font extensions to ensure that you know what font is being used, and then it should render well everywhere.
Also make sure to set this in jasperreports.properties:
net.sf.jasperreports.awt.ignore.missing.font=false
That's great for testing since it catches missing fonts immediately.
†By "usually" I mean "so often that it's indistinguishable from always". But of course it's theoretically possible that there is some other source in this case.
I wanted to localize my app to my Tamil language. I was disappointed that Java supports only Hindi out of all Indian Languages "out of the box."
I searched the internet for some workaround. I learnt from John O'Conner's blog post and Naotoj Sato's blog post that I've to use a technique called "Font Fallback."
I manually copied the "LATHA.TTF" Tamil font available for Windows to /jre/lib/fonts/fallback directory.
It worked! But how can I copy the font programmatically to my users' /jre/lib/fonts/fallback directory?
I thought to add a code that will copy the included font to that fallback directory during the first launch and if it is not already there. Will it cause any permission problems like "Write access denied" to that folder or something?
Or is there a way to make the app search for the fallback font to application directory instead of /jre/lib/fonts/fallback?
Note that the app will have to use this LATHA font only when Tamil language is selected and default font for all other languages.
Please give your opinions.
There seems to be no way to programmatically copy the fallback font to jre if it is in system location without admin rights. It works only if the jre is in some other location. So I have finally decided to put a readme file asking users to copy the font manually if they want it. Expecting Java to support Tamil by default soon.
Hope this will be useful for anyone searching for something like this.
I'm working on an application that accepts text in English and performs transliteration with a custom 3rd party API into an Indic language (one of several that are supported). The application is targeted at Windows XP/7 and Ubuntu.
We use a custom input method that loads the required Indic font, and uses it render text. Also, the user can correct the transliterated text by typing in English and pressing space (similar to how Google Transliterate works).
The problem is that with certain Indic fonts, typing in English shows up empty box characters (even though the actual characters typed are detected and transliterated accordingly).
I have used the ttf-indic-fonts-0.5.0 font pack that comes with Ubuntu, and was able to substitute some of them. For the others, if I copy the corresponding font from Windows (I'm developing this on Windows 7) then all problems are solved.
However, we cannot redistribute Windows fonts with our application and want an open alternative.
Other than trying to find a substitute font, is there anything else that we're doing wrong, or need to check, to make sure that English characters can be typed in a JTextField when an Indic font is being used?
As an example - from the Ubuntu package mentioned above, the lohit_pa.ttf font for Punjabi has this problem. If I copy the default Windows font for Punjabi (raavi.ttf) then it works fine.
I found a solution to the problem. I installed the fonts on Windows (open the font, click install) and browsed the contents using Character Map. These fonts only have glyphs for the language in question, not English.
I used FontForge to merge the 2 fonts. (Fontforge's author doesn't provide binaries anymore - but if you have access to Ubuntu you can install it from the repository. No such luck if you only have Windows).
After this, I'm able to type in English again.