I have a field in Jasper Report. I'm printing the report in PDF.
The field contains some special characters like : ( & # 128309;)
But the character doesn't print properly. I'm having simply the text & # 128309; printed.
How can I get Jasperreport print correctly the special character?
The problem with PDF is it cannot use Unicode directly nor emoji characters such as a blue circle symbol.
What a PDF writer like Windows Chrome has to do is find the nearest TTF font character so in this case a black circle as used by "Segoe UI emoji" font (seen in the text description in lower part of image). Then use that for the text, and then the HTML 2 PDF printer driver can print a coloured circle over the top. We can see 1 of the 2 circles is untouched as pale blue, but just for contrast I set the inner circle (ALL that text on the left) to pink.
So using SVG or coloured emoji fonts uses tons of storage, for what should simply be a few characters defining a circle as 4 arcs.
the black characters definition is much smaller but for one circular character it is also overkill to state it is simply
<a0>and that is without the Kilobytes needed for the fonts embedding. Clearly the more characters used the lesser the overheads but still way beyond what is required, for◌ (blue)in say Arial.Here is the map for the many KB of imbedded font where 1 symbol as drawn on page as
<a0>gets converted into Unicode<D83DDD35>just for one Cmap this again is far more than needed, but that is PDF (designed before Unicode took traction). To see how the HTML Entity (decimal) code for Blue Circle number is in use to convert into UTF-16 (hex) 0xD83D 0xDD35 (d83ddd35) see https://www.fileformat.info/info/unicode/char/1f535/index.htmTo minimise that really heavy usage of resources consider simply using a stock page font like Arial 25cf ● enlarge the scale (avoid setting it Bold that's another font) and colour it blue
<b style="font-size:50px; color:blue;">●</b>, will save a fantastic amount of storage, especially if used repeatedly for bullet points etc.The largest component, on this page, is all the different fonts.
a good PDF writer should spot duplication and optimise by reference and compression but even so IF I use that symbol by copy a few times on this same page, the file size still creeps up from 380 KB to 390 KB (10000 bytes) for what should only be a handful of repeated letters.