Colored emoji support
まだ誰も着手していません。
評価
調査の方向性
The issue includes a Flying Saucer example, font registrations, and simplified XHTML, but names no OpenPDF source files or tests. Start by tracing how OpenPDF handles embedded emoji font color data when rendering PDF text; then identify the relevant tests. Done means colored emoji render in color in the generated PDF, rather than black and white.
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
We use openpdf through flying saucer and we would like to be able to render UTF-8 colored emoji. Until now we are juste able to render them in black and white (or the unique color chosen for the font).
We tried with :
- Roboto One Color -> nothing is rendered
- Roboto One B&W -> rendered in b&w (normal)
- Emoji One Color -> rendered in b&w
I assume that currently openpdf don't take into account the color info in the emoji font. Is it right or am I just doing something wrong ?
Here is the code used to create the pdf from the html
final var processedHtml = templateProcessor.process(templateName, parameters);
try (var os = new ByteArrayOutputStream()) {
final var renderer = new ITextRenderer();
renderer.setDocumentFromString(addTagWhenDetectingEmoji(processedHtml.replaceAll(xml10pattern, "")));
renderer.getFontResolver().addFont("templates/fonts/Roboto-Regular.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
renderer.getFontResolver().addFont("templates/fonts/EmojiOneColor.otf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
renderer.layout();
renderer.createPDF(os, true);
renderer.finishPDF();
return os.toByteArray();
} catch (IOException e) {
throw new PDFGenerationException("Cannot open FileOutputStream", e);
}
A simplified html given as input
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Bulletins</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<table class="w100">
<tr>
<td class="smallerBottomTableBorder"><h2>Avis du conseil de classe</h2></td>
</tr>
<tr>
<td class="text-justify line-return"><span >salut <span style="font-family: 'EmojiOne', sans-serif;">😃</span></span></td>
</tr>
</table>
</body>
</html>
Describe the solution you'd like
Adding the ability to render UTF-8 colored emoji in openpdf
Describe alternatives you've considered
Keeping the emoji in black and white
Additional context
/
- 主要言語
- Java
- スター
- 4.4k
- フォーク
- 714
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
LibrePDF/OpenPDF のほかの issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
IndexOutOfBoundsException in PdfReader対応中かも @andreasrosdalw が 93 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
`PdfSmartCopy` can take effectively unbounded time on nested shared Form XObjects対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
LibrePDF/OpenPDF の issue をすべて見る
似ている issue
-
bug web-server
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jooby-project/jooby#4035 ·
メンテナーはふだん 1 日以内に返信
-
L: javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dependabot/dependabot-core#16744 ·
メンテナーはふだん 1 日以内に返信
-
intake mcp-intake needs-human-review priority:high type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Ikalus1988/MisakaNet#3987 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
quarkiverse/quarkus-google-cloud-services#1187 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
locationtech/jts#1250 ·