pharo-graphics / Alexandrie

FFI bindings and a 2D canvas for Pharo based on Cairo, Freetype and Harfbuzz
MIT License
5 stars 2 forks source link

Render blank emoji #16

Open tinchodias opened 1 year ago

tinchodias commented 1 year ago

Execute this example: AeHarfbuzzRenderExample class>>#example6Emoji

It should look as this capture (without Harfbuzz on top, with Harfbuzz bottom):

Screen Shot 2022-10-25 at 16 49 06

But you get a blank form

tinchodias commented 1 year ago

A tip to investigate: To make the screen capture with the expected output, I touched the code to use a new instance of FT_Face for each line.

tinchodias commented 11 months ago

I'm debugging a bit more. Recent versions and with integration of Harfbuzz and Cairo show it again.

Versions:

{ AeCairoLibrary uniqueInstance versionString.
  AeFTLibrary newInitialized versionString.
  AeHarfbuzzLibrary uniqueInstance versionString }.
">>> #('1.18.0' '2.13.2' '8.3.0')"

Script:

string := (WideString streamContents: [ :stream |
    #( 16r1F468 16r1F469 16r1F467 16r1F466 )
        do: [ :each | stream nextPut: (Unicode value: each) ]
        separatedBy: [ stream nextPut: Unicode zeroWidthJoiner ]]). 

fontSize := 150.
blob := AeHbBlob newLocatedAt:AeNotoColorEmojiDownloadedFont new fileReference.
blob faceCount.
face := blob newHbFaceAtIndex: 0.
font := face newHbFont.
cairoFontOptions :=
    AeCairoFontOptions new
        hintMetrics: AeCairoHintMetrics off;
        hintStyle: AeCairoHintStyle none;
        colorMode: AeCairoGlyphColorMode color;
        yourself.
cairoFontFace := font newCairoFontFace.

cairoSurface := AeCairoImageSurface
    extent: 1000 @ (fontSize * 2)
    format: AeCairoSurfaceFormat argb32.
cairoSurface status ensureIsSuccess.

cairoContext := cairoSurface newContext.
cairoContext translateByX: 0 y: (fontSize * 1.0).
cairoContext sourceColor: Color blue.
cairoContext fontFace: cairoFontFace.
cairoContext fontSize: fontSize.
cairoContext fontOptions: cairoFontOptions.
cairoScaledFont := cairoContext scaledFont.
glyphArray := cairoScaledFont glyphArrayForString: string.
cairoContext showGlyphs: glyphArray.
cairoSurface inspect.
Screenshot 2023-11-23 at 11 55 45

But still to close this issue: