Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF, advanced glyp handling: Khmer Unicode (Hanuman Font) Not Rendering Correctly #2058

Closed
speckyspooky opened this issue Feb 23, 2025 · 6 comments · Fixed by #2059
Closed
Assignees
Labels
Enhancement Small change to improve the current supported functionality
Milestone

Comments

@speckyspooky
Copy link
Contributor

Discussed in #2040

Originally posted by sinsarath February 3, 2025
Hello everyone,

I'm using Eclipse BIRT Report Designer on macOS to generate reports in PDF format, but I’m facing issues with rendering Khmer Unicode (Hanuman Font). The Khmer characters either:

  • Appear as blank or missing text, or
  • Show incorrect khmer characters.

What I’ve Tried:

  1. Installed Khmer Hanuman Font on macOS and confirmed it works in other applications.
  2. Set Khmer Hanuman Font in BIRT: In the report design, I applied Hanuman under Font properties of text elements.
  3. Modified fontsConfig.xml:
  • Located the file in my BIRT runtime folder and added:
<?xml version="1.0" encoding="UTF-8"?>
<font>
	<font-aliases>
		<mapping name="serif" font-family="Times-Roman" />
		<mapping name="sans-serif" font-family="Helvetica" />
		<mapping name="monospace" font-family="Courier" />
		<mapping name="cursive" font-family="Times-Roman" />
		<mapping name="fantasy" font-family="Times-Roman" />
	</font-aliases>

	<search-sequences>
		<sequence locale="zh_CN">
			<catalog name="Western" />
			<catalog name="Chinese_S" />
			<catalog name="Chinese_T" />
			<catalog name="Chinese" />
			<catalog name="Japanese" />
			<catalog name="Korean" />
		</sequence>
		<sequence locale="zh">
			<catalog name="Western" />
			<catalog name="Chinese_T" />
			<catalog name="Chinese_S" />
			<catalog name="Chinese" />
			<catalog name="Japanese" />
			<catalog name="Korean" />
		</sequence>
		<sequence locale="ja">
			<catalog name="Western" />
			<catalog name="Japanese" />
			<catalog name="Chinese" />
			<catalog name="Korean" />
		</sequence>
		<sequence locale="ko">
			<catalog name="Western" />
			<catalog name="Korean" />
			<catalog name="Chinese" />
			<catalog name="Japanese" />
		</sequence>
	</search-sequences>

	<composite-font name="all-fonts" font-family="Times-Roman">
	</composite-font>

	<font-paths>
		<path path="C:/windows/fonts" />
		<path path="d:/windows/fonts" />
		<path path="e:/windows/fonts" />
		<path path="f:/windows/fonts" />
		<path path="g:/windows/fonts" />
		<path path="C:/WINNT/fonts" />
		<path path="d:/WINNT/fonts" />
		<path path="e:/WINNT/fonts" />
		<path path="f:/WINNT/fonts" />
		<path path="g:/WINNT/fonts" />
		<path path="/usr/X/lib/X11/fonts/TrueType" />
		<path path="/usr/share/fonts/default/TrueType" />
		<path path="/usr/openwin/lib/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_2/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_5/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_7/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_9/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_13/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_15/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ar/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/hi_IN.UTF-8/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ja/X11/fonts/TT" />
		<path path="/usr/openwin/lib/locale/ko/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/KOI8-R/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ru.ansi-1251/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT" />
		<path path="/usr/openwin/lib/locale/zh_HK.BIG5HK/X11/fonts/TT" />
		<path path="/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh.GBK/X11/fonts/TrueType" />
		<path path="/usr/X11R6/lib/X11/fonts/TrueType" />
		<path path="/usr/X11R6/lib/X11/fonts/truetype" />
		<path path="/usr/X11R6/lib/X11/fonts/tt" />
		<path path="/usr/X11R6/lib/X11/fonts/TTF" />
		<path path="/usr/X11R6/lib/X11/fonts/OTF" />
		<path path="/usr/share/fonts/ja/TrueType" />
		<path path="/usr/share/fonts/truetype" />
		<path path="/usr/share/fonts/ko/TrueType" />
		<path path="/usr/share/fonts/zh_CN/TrueType" />
		<path path="/usr/share/fonts/zh_TW/TrueType" />
		<path path="/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" />
		<path path="/usr/share/fonts/TTF" />
		<path path="/usr/share/fonts/OTF" />
                <path path="/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.birt.report.engine.fonts_4.18.0.v202409161007/Fonts" />
	</font-paths>
</font>

  • Restarted Eclipse after making the changes.
  1. Checked PDF Output Encoding:
  • Tried setting UTF-8 encoding in BIRT preferences.
  • But I don’t see the "Embed Fonts" option in the Eclipse UI.
  1. Database Encoding: My database (SQL Server) is set to UTF-8 to support Khmer characters.

Questions:

  1. How can I properly embed Khmer Unicode fonts (Hanuman) in BIRT PDF output on macOS?
  2. Why is the "Embed Fonts" option missing in Eclipse BIRT Report Designer?
  3. Is there a better PDF Emitter for BIRT that supports Khmer Unicode?
  4. Are there any macOS-specific configurations needed for font embedding in BIRT?

Any help would be greatly appreciated. Thank you!

@speckyspooky speckyspooky added this to the 4.19 milestone Feb 23, 2025
@speckyspooky speckyspooky self-assigned this Feb 23, 2025
@speckyspooky speckyspooky added the Enhancement Small change to improve the current supported functionality label Feb 23, 2025
@speckyspooky
Copy link
Contributor Author

I have started a deep debugging session based of the hint LibrePDF/OpenPDF#1264

The advanced glyph handling wasn't supported till now through the BIRT font handling which is based on openPDF.
I will create an enhancement to support the advanced glyph handling.

@speckyspooky
Copy link
Contributor Author

Example of the enabled advanced glyph handling for PDF produced through BIRT with openPDF:

PDF example according to the screen: khmertext.pdf

Image

@sinsarath
Copy link

Great to hear that,
when it official release ? and will support all khmer font ?

@speckyspooky
Copy link
Contributor Author

speckyspooky commented Feb 24, 2025

The change will be part of BIRT 4.19 (if I got the quality approval of it).
Release day is planned March 12, 2025.

I cannot say if all khmer fonts will be supported, the documentation means only that the adanvced glyph handling will be activated with the global setting. But I cannot say if the support for all fonts is given.

glyph handling: https://github.com/LibrePDF/OpenPDF/wiki/Accents,-DIN-91379,-non-Latin-scripts

@speckyspooky
Copy link
Contributor Author

@sinsarath
Short update, the special font handling for your Khmer-font is disabled by default with BIRT 4.19.
I added a configuration that you can enable the special handling. The configuration will be done at file fontsConfig*.xml - see screen.

Please be aware it was working with your font on my side.
But please test it extensively on your side with your reports because I didn't know if there some side effects.

Image

@merks
Copy link
Contributor

merks commented Mar 5, 2025

The 4.19 release is next week so test it quickly.

https://download.eclipse.org/birt/updates/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Small change to improve the current supported functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants