I am following the instructions for defining fallback fonts for missing characters, e.g. special characters not available in the main font used for the document. Select characters are still missing, even though they should be provided by a fallback font.
For example, 田 is avaible in Noto Sans CJK JP (and other Noto Sans CJK fonts). Incidentally, this is a .ttc font, while most of the other fonts are regular .ttf files.
Additionally, the non-rendered characters are replaced by an unrelated character. In the attached example, copying the non-rendered 田 results in a 珍.
Minimal code example used to generate the attached files:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
FontSettings fontSettings = FontSettings.getDefaultInstance()
fontSettings.setFontsSources(new FontSourceBase[] { new SystemFontSource() });
fontSettings.getFallbackSettings().loadNotoFallbackSettings();
builder.write(
"Non-working, available from Noto Sans CJK: 田 \n" +
"Other non-working: 眯 眠 眙 眉 省 盶 盱 盘 盐 盏 皮 皇 的 百 白 登 癩 癥 瘠 疣 畴 畳 畲 畱 異 畯 畭 畬 番 畧 畦 略 畤 畣 畢 畡 畔 畑 畅 男 甲 田 用 産 甠 生 甜 甘 甄 瓷 瓦 瓣 瓜 瑸 瑵 瑴 瑳 瑲 瑰 瑯 瑮 瑩 瑥 瑣 瑡 瑞 瑙 瑓 琯 琠 琛 珍\n" +
"Working: \uD808\uDC2D \uFDF5 \uD83D\uDC31 \n"
);
doc.save("/tmp/unicodeExample.docx");
doc.save("/tmp/unicodeExample.pdf", SaveFormat.PDF);
unicodeExample.pdf (32.0 KB)
unicodeExample.docx (7.5 KB)