Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Colored emoji support

オープン
#1,109 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
28/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java
領域
backend

調査の方向性

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 の本文から書いたものです。

説明

enhancement

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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

LibrePDF/OpenPDF のほかの issue

LibrePDF/OpenPDF の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。