try to draw emoji image with windows seguiemj.ttf font failed
See original GitHub issueI am trying to extract high resolution windows color emoji image from seguiemj.ttf .
What I have already know:
- the font stores emoji in svg format (layered vector drawings in COLR/CPAL)
- the font also has a
glyph
table
My roadmap:
use fonttools load seguiemj.ttf --> use fonttools draw high resolution png image --> save to file
for example, I am trying to try 😀 with glyph name u1F600:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
if __name__=="__main__":
import sys
from fontTools.ttLib import TTFont
from reportlab.lib import colors
from fontTools.pens.reportLabPen import ReportLabPen, Path
glyphName = 'u1F600'
imageFile = "%s.png" % glyphName
font = TTFont('seguiemj.ttf')
gs = font.getGlyphSet()
pen = ReportLabPen(gs, Path(fillColor=colors.red, strokeWidth=5))
g = gs[glyphName]
g.draw(pen)
w, h = g.width, 1000
from reportlab.graphics import renderPM
from reportlab.graphics.shapes import Group, Drawing, scale
# Everything is wrapped in a group to allow transformations.
g = Group(pen.path)
g.translate(0, 200)
g.scale(0.3, 0.3)
d = Drawing(w, h)
d.add(g)
renderPM.drawToFile(d, imageFile, fmt="PNG")
I only get image with emji ontline filled with red color.
What I have missed? Or am I totally on the wrong direction?
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
AutoCorrect for some symbol not working well in latest version of
Image. In version 16.0.7830.1013. it's showing as **, and showing ... “Segoe UI Emoji”font is available on Windows 10 (seguiemj.ttf), ...
Read more >Is it possible to use colored Whatsapp/Facebook emoji? #3346
I'm using Pillow 7.0.0 on Ubuntu. This error is due to a freetype limitation. Bitmap fonts don't support scaling with freetype, so you...
Read more >Insert colorful emoji into an image(Python) - Stack Overflow
You need to try those color emoji fonts, like NotoColorEmoji, ... size # unicode_font = ImageFont.truetype(r"E:\segoeuiemoji\seguiemj.ttf", ...
Read more >How to Add Color Emoji to Image in Python - jdhao
In this post, I would like to share how to add color emoji to image with Python. Use Pillow. We can use Pillow...
Read more >Fix Weird Font Problem in Windows 10 - YouTube
Fix Weird Font Problem in Windows 10This is a very weird font problem ... "Segoe UI Emoji (TrueType)"=" seguiemj. ttf " "Segoe UI...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Besides the fact that the Segoe UI Emoji font does not use SVG (the COLR table references glyph IDs that are assumed to refer to glyphs in a glyf, CFF or CFF2 table)…
I have a suspicion that what you are trying to do may be in violation of the license agreement associated with that font.
Code from RoboChrome plugin helps a lot. I know how to get color data and cpal data from tables now. But I still can’t figure out how to draw the color with reportlab pen 😂