-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emoji support #311
Comments
Glyph boxes are usually a sign of not defined. Have you ensured, that this font is actually opened and does display any glyph? |
Actually, the boxes are the second string, "void"... so it looks like there aren't any boxes... select_font_face(cr, "AppleColorEmoji", Cairo.FONT_SLANT_NORMAL, Cairo.FONT_WEIGHT_NORMAL)
set_font_size(cr, 10.0)
move_to(cr, 10.0, 135.0)
show_text(cr, "123🌀🌁🌂🌃🌄🌅🌆🌇🌈🌉🌊")
move_to(cr, 70.0, 165.0)
text_path(cr, "void")
set_source_rgb(cr, 0.5, 0.5, 1)
fill_preserve(cr)
set_source_rgb(cr, 0, 0, 0)
set_line_width(cr, 2.56)
stroke(cr)
# draw helping lines
set_source_rgba(cr, 1, 0.2, 0.2, 0.6)
arc(cr, 10.0, 135.0, 5.12, 0, 2*pi)
close_path(cr)
arc(cr, 70.0, 165.0, 5.12, 0, 2*pi)
fill(cr) displays so the digits (they're also in the font) appear, but the emoji characters don't. |
I there. Is there a package that does draw emojis ? |
Perhaps a plotting package like Plots.jl or Makie.jl might be able to do it. Or work with the terminal with Term.jl etc... Using Cairo.jl and FreeType will get you only black and white images, although I'd love to be proved wrong... using FreeTypeAbstraction
using FixedPointNumbers
using Luxor
using Colors
face = FTFont("/Library/FontLibrary/S/Segoe UI Emoji/seguiemj_0.ttf")
img, metric = renderface(face, Char(0x1F608), 256)
imgg = reinterpret(N0f8, permutedims(img, (2, 1)))
@draw begin
placeimage(convert.(Colors.RGB, imgg), centered=true)
end |
Cairo.jl? No it's stable, as far as I know. (See also the library.) In general, Julia support for fonts and typography is quite limited and spread piecemeal across various packages. Plotting package developers often write their own stuff as needed rather than develop a full-featured typography package. Cross-platform typography support is quite a tough problem... |
I believe Cairo now supports emoji (https://www.phoronix.com/scan.php?page=news_item&px=Cairo-1.15.8-Colored-Emoji) as of 1.15.8. I think Cairo.jl is now based on 1.16.0. So I thought it should be possible to display emoji...
Changing
sample_text.jl
to contain this:just produces empty boxes. Is there a trick to getting them showing? Perhaps it's a FontConfig/FreeType thing?
Edit: I see that on some devices Github can’t display some of the emojis in that string either... But they’re rendered correctly in Julia (n the REPL and in my editor (Atom)).
The text was updated successfully, but these errors were encountered: