Gentoo Archives: gentoo-commits

From: Anna Vyalkova <cyber+gentoo@×××××.in>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: media-fonts/twemoji/, media-fonts/twemoji/files/
Date: Fri, 21 Jan 2022 21:30:45
Message-Id: 1642800632.b853bc715a58c610563f1a3f4c114b50444330f5.cybertailor@gentoo
1 commit: b853bc715a58c610563f1a3f4c114b50444330f5
2 Author: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
3 AuthorDate: Fri Jan 21 20:55:49 2022 +0000
4 Commit: Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
5 CommitDate: Fri Jan 21 21:30:32 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=b853bc71
7
8 media-fonts/twemoji: initial import
9
10 Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>
11
12 media-fonts/twemoji/Manifest | 2 +
13 media-fonts/twemoji/files/75-twemoji.conf | 178 +++++++++++++++++++++
14 .../twemoji/files/noto-build-all-flags.patch | 11 ++
15 media-fonts/twemoji/files/noto-build-path.patch | 11 ++
16 .../twemoji/files/noto-pngquant-verbose.patch | 11 ++
17 media-fonts/twemoji/files/noto-use-gm.patch | 27 ++++
18 media-fonts/twemoji/metadata.xml | 11 ++
19 media-fonts/twemoji/twemoji-13.1.0.ebuild | 116 ++++++++++++++
20 8 files changed, 367 insertions(+)
21
22 diff --git a/media-fonts/twemoji/Manifest b/media-fonts/twemoji/Manifest
23 new file mode 100644
24 index 000000000..c46d4e0c7
25 --- /dev/null
26 +++ b/media-fonts/twemoji/Manifest
27 @@ -0,0 +1,2 @@
28 +DIST twemoji-13.1.0-noto.tar.gz 170352518 BLAKE2B 545e58d47b247998c0f376bbc9ec43fcb2ac4c1d24465420ae43a168987dcb7c4eba873b9cc64cfc6ffce3290551242d7e44ed69606f9c3d8a59dbeeddc3cdb2 SHA512 a7ea0c33f4703749d8a30f4be2fac5971429dcec7b6feed2645854d9ae1eebb428597a56ad148c3732e320a65d4133da30c0003ed39f07c5270462e31fdf3d0b
29 +DIST twemoji-13.1.0.tar.gz 4646713 BLAKE2B b144e76f2428d1fc523742a9501ac7c73af04e9d0ce4c1b5c5131da21d2a69416a8f3512dd0ffd01dd44e7b7620311abb8ced5c45f10c70ca9ec20406583820c SHA512 a1463c76a2bbcece8871cb868967c0bff74a495bf88d28e41c8962ed12ffba1966ee622f72f6da2222a06db8debb62ae89fe1fffcd9272e8aa3fcc029713115b
30
31 diff --git a/media-fonts/twemoji/files/75-twemoji.conf b/media-fonts/twemoji/files/75-twemoji.conf
32 new file mode 100644
33 index 000000000..2dae48836
34 --- /dev/null
35 +++ b/media-fonts/twemoji/files/75-twemoji.conf
36 @@ -0,0 +1,178 @@
37 +<?xml version="1.0" encoding="UTF-8"?>
38 +<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
39 +<fontconfig>
40 +
41 + <!--
42 + Treat this file as a reference and modify as necessary if you are not satisfied with the results.
43 +
44 +
45 + This config attempts to guarantee that colorful emojis from Twemoji will be displayed,
46 + no matter how badly the apps and websites are written.
47 +
48 + It uses a few different tricks, some of which introduce conflicts with other fonts.
49 + -->
50 +
51 +
52 + <!--
53 + This adds a generic family 'emoji',
54 + aimed for apps that don't specify specific font family for rendering emojis.
55 + -->
56 + <match target="pattern">
57 + <test qual="any" name="family"><string>emoji</string></test>
58 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
59 + </match>
60 +
61 + <!--
62 + This adds Twemoji as a final fallback font for the default font families.
63 + In this case, Twemoji will be selected if and only if no other font can provide a given symbol.
64 +
65 + Note that usually other fonts will have some glyphs available (e.g. Symbola or DejaVu fonts),
66 + causing some emojis to be rendered in black-and-white.
67 + -->
68 + <match target="pattern">
69 + <test name="family"><string>sans</string></test>
70 + <edit name="family" mode="append"><string>Twemoji</string></edit>
71 + </match>
72 +
73 + <match target="pattern">
74 + <test name="family"><string>serif</string></test>
75 + <edit name="family" mode="append"><string>Twemoji</string></edit>
76 + </match>
77 +
78 + <match target="pattern">
79 + <test name="family"><string>sans-serif</string></test>
80 + <edit name="family" mode="append"><string>Twemoji</string></edit>
81 + </match>
82 +
83 + <match target="pattern">
84 + <test name="family"><string>monospace</string></test>
85 + <edit name="family" mode="append"><string>Twemoji</string></edit>
86 + </match>
87 +
88 + <!--
89 + If other fonts contain emoji glyphs, they could interfere and make some emojis rendered in wrong font (often in black-and-white).
90 + For example, DejaVu Sans contains black-and-white emojis, which we can remove using the following trick:
91 + -->
92 + <match target="scan">
93 + <test name="family" compare="contains">
94 + <string>DejaVu</string>
95 + </test>
96 + <edit name="charset" mode="assign" binding="same">
97 + <minus>
98 + <name>charset</name>
99 + <charset>
100 + <range>
101 + <int>0x1f600</int>
102 + <int>0x1f640</int>
103 + </range>
104 + </charset>
105 + </minus>
106 + </edit>
107 + </match>
108 +
109 + <!--
110 + Recognize legacy ways of writing EmojiOne family name.
111 + -->
112 + <match target="pattern">
113 + <test qual="any" name="family"><string>EmojiOne</string></test>
114 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
115 + </match>
116 +
117 + <match target="pattern">
118 + <test qual="any" name="family"><string>Emoji One</string></test>
119 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
120 + </match>
121 +
122 + <match target="pattern">
123 + <test qual="any" name="family"><string>EmojiOne Color</string></test>
124 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
125 + </match>
126 +
127 + <match target="pattern">
128 + <test qual="any" name="family"><string>EmojiOne Mozilla</string></test>
129 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
130 + </match>
131 +
132 + <!--
133 + Use Twemoji when other popular fonts are being specifically requested.
134 +
135 + It is quite common that websites would only request Apple and Google emoji fonts.
136 + These aliases will make Twemoji be selected in such cases to provide good-looking emojis.
137 +
138 + This obviously conflicts with other emoji fonts if you have them installed.
139 + -->
140 + <match target="pattern">
141 + <test qual="any" name="family"><string>Apple Color Emoji</string></test>
142 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
143 + </match>
144 +
145 + <match target="pattern">
146 + <test qual="any" name="family"><string>Segoe UI Emoji</string></test>
147 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
148 + </match>
149 +
150 + <match target="pattern">
151 + <test qual="any" name="family"><string>Segoe UI Symbol</string></test>
152 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
153 + </match>
154 +
155 + <match target="pattern">
156 + <test qual="any" name="family"><string>Noto Color Emoji</string></test>
157 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
158 + </match>
159 +
160 + <match target="pattern">
161 + <test qual="any" name="family"><string>NotoColorEmoji</string></test>
162 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
163 + </match>
164 +
165 + <match target="pattern">
166 + <test qual="any" name="family"><string>Android Emoji</string></test>
167 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
168 + </match>
169 +
170 + <match target="pattern">
171 + <test qual="any" name="family"><string>Noto Emoji</string></test>
172 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
173 + </match>
174 +
175 + <match target="pattern">
176 + <test qual="any" name="family"><string>Twitter Color Emoji</string></test>
177 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
178 + </match>
179 +
180 + <match target="pattern">
181 + <test qual="any" name="family"><string>JoyPixels</string></test>
182 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
183 + </match>
184 +
185 + <match target="pattern">
186 + <test qual="any" name="family"><string>Twemoji Mozilla</string></test>
187 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
188 + </match>
189 +
190 + <match target="pattern">
191 + <test qual="any" name="family"><string>TwemojiMozilla</string></test>
192 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
193 + </match>
194 +
195 + <match target="pattern">
196 + <test qual="any" name="family"><string>EmojiTwo</string></test>
197 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
198 + </match>
199 +
200 + <match target="pattern">
201 + <test qual="any" name="family"><string>Emoji Two</string></test>
202 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
203 + </match>
204 +
205 + <match target="pattern">
206 + <test qual="any" name="family"><string>EmojiSymbols</string></test>
207 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
208 + </match>
209 +
210 + <match target="pattern">
211 + <test qual="any" name="family"><string>Symbola</string></test>
212 + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit>
213 + </match>
214 +</fontconfig>
215
216 diff --git a/media-fonts/twemoji/files/noto-build-all-flags.patch b/media-fonts/twemoji/files/noto-build-all-flags.patch
217 new file mode 100644
218 index 000000000..564b08a59
219 --- /dev/null
220 +++ b/media-fonts/twemoji/files/noto-build-all-flags.patch
221 @@ -0,0 +1,11 @@
222 +--- old/Makefile 2018-05-03 20:32:14.000000000 +0200
223 ++++ new/Makefile 2018-05-08 11:48:20.811073447 +0200
224 +@@ -78,7 +78,7 @@
225 +
226 + ALL_FLAGS = $(basename $(notdir $(wildcard $(FLAGS_SRC_DIR)/*.png)))
227 +
228 +-FLAGS = $(SELECTED_FLAGS)
229 ++FLAGS = $(ALL_FLAGS)
230 +
231 + FLAG_NAMES = $(FLAGS:%=%.png)
232 + FLAG_FILES = $(addprefix $(FLAGS_DIR)/, $(FLAG_NAMES))
233
234 diff --git a/media-fonts/twemoji/files/noto-build-path.patch b/media-fonts/twemoji/files/noto-build-path.patch
235 new file mode 100644
236 index 000000000..151f88251
237 --- /dev/null
238 +++ b/media-fonts/twemoji/files/noto-build-path.patch
239 @@ -0,0 +1,11 @@
240 +--- a/add_glyphs.py.old 2018-11-18 11:11:56.387323302 +0100
241 ++++ b/add_glyphs.py 2018-11-18 11:12:18.203529159 +0100
242 +@@ -22,7 +22,7 @@
243 + import add_emoji_gsub
244 + import add_aliases
245 +
246 +-sys.path.append(
247 ++sys.path.insert(0,
248 + path.join(os.path.dirname(__file__), 'third_party', 'color_emoji'))
249 + from png import PNG
250 +
251
252 diff --git a/media-fonts/twemoji/files/noto-pngquant-verbose.patch b/media-fonts/twemoji/files/noto-pngquant-verbose.patch
253 new file mode 100644
254 index 000000000..8a152bea2
255 --- /dev/null
256 +++ b/media-fonts/twemoji/files/noto-pngquant-verbose.patch
257 @@ -0,0 +1,11 @@
258 +--- a/Makefile~ 2020-04-22 23:04:44.000000000 +0200
259 ++++ b/Makefile 2020-04-22 23:06:42.069275340 +0200
260 +@@ -20,7 +20,7 @@
261 +
262 + PNGQUANT = pngquant
263 + PYTHON = python3
264 +-PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force
265 ++PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force -v
266 + BODY_DIMENSIONS = 136x128
267 + IMOPS := -size $(BODY_DIMENSIONS) canvas:none -compose copy -gravity center
268 +
269
270 diff --git a/media-fonts/twemoji/files/noto-use-gm.patch b/media-fonts/twemoji/files/noto-use-gm.patch
271 new file mode 100644
272 index 000000000..6b51d0f52
273 --- /dev/null
274 +++ b/media-fonts/twemoji/files/noto-use-gm.patch
275 @@ -0,0 +1,27 @@
276 +--- a/Makefile~ 2019-03-28 17:45:53.000000000 +0100
277 ++++ b/Makefile 2019-06-02 10:36:55.587055453 +0200
278 +@@ -21,7 +21,7 @@
279 + PNGQUANT = pngquant
280 + PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force
281 + BODY_DIMENSIONS = 136x128
282 +-IMOPS := -size $(BODY_DIMENSIONS) canvas:none -compose copy -gravity center
283 ++IMOPS = -size 136x128 -background none -gravity center -extent 136x128 -compose copy
284 +
285 + # zopflipng is better (about 5-10%) but much slower. it will be used if
286 + # present. pass ZOPFLIPNG= as an arg to make to use optipng instead.
287 +@@ -165,13 +165,13 @@
288 + # imagemagick packaged with ubuntu trusty (6.7.7-10) by using -composite.
289 +
290 + $(EMOJI_DIR)/%.png: $(EMOJI_SRC_DIR)/%.png | $(EMOJI_DIR)
291 +- @convert $(IMOPS) "$<" -composite "PNG32:$@"
292 ++ @gm convert $(IMOPS) "$<" "PNG32:$@"
293 +
294 + $(FLAGS_DIR)/%.png: $(FLAGS_SRC_DIR)/%.png ./waveflag | $(FLAGS_DIR)
295 + @./waveflag $(FLAGS_DIR)/ "$<"
296 +
297 + $(RESIZED_FLAGS_DIR)/%.png: $(FLAGS_DIR)/%.png | $(RESIZED_FLAGS_DIR)
298 +- @convert $(IMOPS) "$<" -composite "PNG32:$@"
299 ++ @gm convert $(IMOPS) "$<" "PNG32:$@"
300 +
301 + flag-symlinks: $(RESIZED_FLAG_FILES) | $(RENAMED_FLAGS_DIR)
302 + @$(subst ^, , \
303
304 diff --git a/media-fonts/twemoji/metadata.xml b/media-fonts/twemoji/metadata.xml
305 new file mode 100644
306 index 000000000..4092a19fc
307 --- /dev/null
308 +++ b/media-fonts/twemoji/metadata.xml
309 @@ -0,0 +1,11 @@
310 +<?xml version="1.0" encoding="UTF-8"?>
311 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
312 +<pkgmetadata>
313 + <maintainer type="person">
314 + <email>cyber+gentoo@×××××.in</email>
315 + <name>Anna</name>
316 + </maintainer>
317 + <upstream>
318 + <remote-id type="github">twitter/twemoji</remote-id>
319 + </upstream>
320 +</pkgmetadata>
321
322 diff --git a/media-fonts/twemoji/twemoji-13.1.0.ebuild b/media-fonts/twemoji/twemoji-13.1.0.ebuild
323 new file mode 100644
324 index 000000000..dd8495937
325 --- /dev/null
326 +++ b/media-fonts/twemoji/twemoji-13.1.0.ebuild
327 @@ -0,0 +1,116 @@
328 +# Copyright 1999-2021 Gentoo Authors
329 +# Distributed under the terms of the GNU General Public License v2
330 +
331 +EAPI=7
332 +PYTHON_COMPAT=( python3_{8..10} )
333 +
334 +inherit font python-any-r1
335 +
336 +NOTO_PV="2.034"
337 +DESCRIPTION="A color emoji font with a flat visual style, designed and used by Twitter"
338 +HOMEPAGE="https://twemoji.twitter.com"
339 +SRC_URI="https://github.com/googlefonts/noto-emoji/archive/refs/tags/v${NOTO_PV}.tar.gz -> ${P}-noto.tar.gz
340 + https://github.com/twitter/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
341 +S="${WORKDIR}/noto-emoji-${NOTO_PV}"
342 +
343 +LICENSE="Apache-2.0 CC-BY-4.0 MIT OFL-1.1"
344 +SLOT="0"
345 +KEYWORDS="~amd64"
346 +
347 +BDEPEND="
348 + ${PYTHON_DEPS}
349 + app-arch/zopfli
350 + $(python_gen_any_dep '
351 + >=dev-python/fonttools-4.7.0[${PYTHON_USEDEP}]
352 + >=dev-python/nototools-0.2.13[${PYTHON_USEDEP}]
353 + ')
354 + media-gfx/pngquant
355 + x11-libs/cairo
356 + || ( media-gfx/imagemagick[png] media-gfx/graphicsmagick[png] )
357 +"
358 +
359 +RESTRICT="binchecks strip"
360 +
361 +DOCS=( CONTRIBUTING.md FOLDERS.md LEGACY.md README.md )
362 +
363 +PATCHES=(
364 + # https://github.com/googlei18n/noto-emoji/issues/240
365 + "${FILESDIR}"/noto-build-path.patch
366 + # Be more verbose
367 + "${FILESDIR}"/noto-pngquant-verbose.patch
368 +
369 +)
370 +
371 +FONT_S="${S}"
372 +FONT_SUFFIX="ttf"
373 +FONT_CONF=( "${FILESDIR}"/75-${PN}.conf )
374 +
375 +python_check_deps() {
376 + has_version -b "dev-python/fonttools[${PYTHON_USEDEP}]" &&
377 + has_version -b "dev-python/nototools[${PYTHON_USEDEP}]"
378 +}
379 +
380 +pkg_setup() {
381 + font_pkg_setup
382 +}
383 +
384 +src_unpack() {
385 + default
386 +
387 + mv "${WORKDIR}"/${P}/assets "${S}" || die
388 + mv "${WORKDIR}"/${P}/*.md "${S}" || die
389 +}
390 +
391 +src_prepare() {
392 + default
393 +
394 + # Be more verbose
395 + sed -i -e 's:\(@$(ZOPFLIPNG) -y "$<" "$@"\) 1> /dev/null 2>&1:\1:g' Makefile || die
396 +
397 + # Based on Fedora patch to allow graphicsmagick usage
398 + if has_version -b media-gfx/graphicsmagick; then
399 + eapply "${FILESDIR}/noto-use-gm.patch"
400 + fi
401 +
402 + sed NotoColorEmoji.tmpl.ttx.tmpl \
403 + -e "s/Noto Color Emoji/${PN^}/" \
404 + -e "s/NotoColorEmoji/${PN^}/" \
405 + -e "s/Copyright .* Google Inc\./Twitter, Inc and other contributors./" \
406 + -e "s/ Version .*/ ${PV}/" \
407 + -e "s/.*is a trademark.*//" \
408 + -e "s/Google, Inc\./Twitter, Inc and other contributors/" \
409 + -e "s,http://www.google.com/get/noto/,https://twemoji.twitter.com," \
410 + -e "s/.*is licensed under.*/ Creative Commons Attribution 4.0 International/" \
411 + -e "s,http://scripts.sil.org/OFL,http://creativecommons.org/licenses/by/4.0/," \
412 + > ${PN^}.tmpl.ttx.tmpl || die
413 +
414 + pushd assets/72x72 || die
415 + for png in *.png; do
416 + mv ${png} emoji_u${png//-/_} || die
417 + done
418 +}
419 +
420 +src_compile() {
421 + python_setup
422 + einfo "Building fonts..."
423 +
424 + emake EMOJI=${PN^} EMOJI_SRC_DIR="assets/72x72" \
425 + FLAGS= BODY_DIMENSIONS=76x72 \
426 + BYPASS_SEQUENCE_CHECK=true \
427 + VIRTUAL_ENV=true
428 +}
429 +
430 +src_install() {
431 + rm NotoColorEmoji_WindowsCompatible.ttf *.tmpl.ttf || die
432 +
433 + # Don't lose fancy emoji icons
434 + insinto /usr/share/icons/${PN}/72/emotes/
435 + doins assets/72x72/*.png
436 +
437 + insinto /usr/share/icons/${PN}/scalable/emotes/
438 + doins assets/svg/*.svg
439 +
440 + font_src_install
441 +
442 + einstalldocs
443 +}