Skip to content

Commit

Permalink
feat: add fitz modifier and zero width joiner to emoji tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ι—«θŒ‚ζΊ committed May 27, 2024
1 parent 633a5f4 commit 3248415
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lib/src/test/java/io/github/jmecn/font/image/TestEmojiImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public class TestEmojiImage {

static final String APPLE_EMOJI = "/System/Library/Fonts/Apple Color Emoji.ttc";
static final String TEXT = "πŸ™‹πŸ‘‹πŸ°πŸ’" + "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦";
static final String TEXT = "πŸ™‹\uD83E\uDDD1\uD83E\uDDD1\uD83C\uDFFB\uD83E\uDDD1\uD83C\uDFFC\uD83E\uDDD1\uD83C\uDFFD\uD83E\uDDD1\uD83C\uDFFE\uD83E\uDDD1\uD83C\uDFFFπŸ°πŸ’" + "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦";

public static void main(String[] args) {
// init lwjgl3 harfbuzz with freetype
Expand Down Expand Up @@ -68,18 +68,15 @@ public static void main(String[] args) {
System.out.printf("glyph_count:%d\n", glyph_count);

for (int i = 0; i < glyph_count; i++) {
int codepoint = glyph_info.get(i).codepoint();
int glyphIndex = face.getCharIndex(codepoint);
int glyphIndex = glyph_info.get(i).codepoint();
if (glyphIndex == 0) {
System.err.printf("char not found, codepoint:0x%X\n", codepoint);
// continue;
System.err.printf("char not found, glyphIndex:0x%X\n", glyphIndex);
continue;
} else {
System.out.printf("char found, codepoint:0x%X, glyphIndex:%d\n", codepoint, glyphIndex);
System.out.printf("char found, glyphIndex:0x%X\n", glyphIndex);
}
System.out.printf("codepoint=0x%08X, glyphIndex=0x%08X\n", codepoint, glyphIndex);
// load glyph
if (face.loadGlyph(codepoint, FT_LOAD_DEFAULT | FT_LOAD_COLOR)) {
System.out.println("load glyph success, codepoint:" + codepoint + ", glyphIndex:" + glyphIndex);
if (face.loadGlyph(glyphIndex, FT_LOAD_DEFAULT | FT_LOAD_COLOR)) {
// get glyph
FtGlyphSlot slot = face.getGlyph();
FtGlyphMetrics metrics = slot.getMetrics();
Expand All @@ -97,7 +94,7 @@ public static void main(String[] args) {
Image image = ImageUtils.ftBitmapToImage(bitmap, ColorRGBA.White, 1.8f);
imageList.add(image);
} else {
System.err.println("load glyph failed, codepoint:" + codepoint + ", glyphIndex:" + glyphIndex);
System.err.println("load glyph failed, glyphIndex:" + glyphIndex);
}
}

Expand Down

0 comments on commit 3248415

Please sign in to comment.