diff options
author | Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in> | 2022-01-22 01:55:49 +0500 |
---|---|---|
committer | Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in> | 2022-01-22 02:30:32 +0500 |
commit | b853bc715a58c610563f1a3f4c114b50444330f5 (patch) | |
tree | 4ad8afd682440a6d0f561d0e17d6b37847b36cb7 /media-fonts | |
parent | net-irc/catgirl: add 2.0a, drop 1.9a (diff) | |
download | guru-b853bc715a58c610563f1a3f4c114b50444330f5.tar.gz guru-b853bc715a58c610563f1a3f4c114b50444330f5.tar.bz2 guru-b853bc715a58c610563f1a3f4c114b50444330f5.zip |
media-fonts/twemoji: initial import
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
Diffstat (limited to 'media-fonts')
-rw-r--r-- | media-fonts/twemoji/Manifest | 2 | ||||
-rw-r--r-- | media-fonts/twemoji/files/75-twemoji.conf | 178 | ||||
-rw-r--r-- | media-fonts/twemoji/files/noto-build-all-flags.patch | 11 | ||||
-rw-r--r-- | media-fonts/twemoji/files/noto-build-path.patch | 11 | ||||
-rw-r--r-- | media-fonts/twemoji/files/noto-pngquant-verbose.patch | 11 | ||||
-rw-r--r-- | media-fonts/twemoji/files/noto-use-gm.patch | 27 | ||||
-rw-r--r-- | media-fonts/twemoji/metadata.xml | 11 | ||||
-rw-r--r-- | media-fonts/twemoji/twemoji-13.1.0.ebuild | 116 |
8 files changed, 367 insertions, 0 deletions
diff --git a/media-fonts/twemoji/Manifest b/media-fonts/twemoji/Manifest new file mode 100644 index 000000000..c46d4e0c7 --- /dev/null +++ b/media-fonts/twemoji/Manifest @@ -0,0 +1,2 @@ +DIST twemoji-13.1.0-noto.tar.gz 170352518 BLAKE2B 545e58d47b247998c0f376bbc9ec43fcb2ac4c1d24465420ae43a168987dcb7c4eba873b9cc64cfc6ffce3290551242d7e44ed69606f9c3d8a59dbeeddc3cdb2 SHA512 a7ea0c33f4703749d8a30f4be2fac5971429dcec7b6feed2645854d9ae1eebb428597a56ad148c3732e320a65d4133da30c0003ed39f07c5270462e31fdf3d0b +DIST twemoji-13.1.0.tar.gz 4646713 BLAKE2B b144e76f2428d1fc523742a9501ac7c73af04e9d0ce4c1b5c5131da21d2a69416a8f3512dd0ffd01dd44e7b7620311abb8ced5c45f10c70ca9ec20406583820c SHA512 a1463c76a2bbcece8871cb868967c0bff74a495bf88d28e41c8962ed12ffba1966ee622f72f6da2222a06db8debb62ae89fe1fffcd9272e8aa3fcc029713115b diff --git a/media-fonts/twemoji/files/75-twemoji.conf b/media-fonts/twemoji/files/75-twemoji.conf new file mode 100644 index 000000000..2dae48836 --- /dev/null +++ b/media-fonts/twemoji/files/75-twemoji.conf @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> +<fontconfig> + + <!-- + Treat this file as a reference and modify as necessary if you are not satisfied with the results. + + + This config attempts to guarantee that colorful emojis from Twemoji will be displayed, + no matter how badly the apps and websites are written. + + It uses a few different tricks, some of which introduce conflicts with other fonts. + --> + + + <!-- + This adds a generic family 'emoji', + aimed for apps that don't specify specific font family for rendering emojis. + --> + <match target="pattern"> + <test qual="any" name="family"><string>emoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <!-- + This adds Twemoji as a final fallback font for the default font families. + In this case, Twemoji will be selected if and only if no other font can provide a given symbol. + + Note that usually other fonts will have some glyphs available (e.g. Symbola or DejaVu fonts), + causing some emojis to be rendered in black-and-white. + --> + <match target="pattern"> + <test name="family"><string>sans</string></test> + <edit name="family" mode="append"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test name="family"><string>serif</string></test> + <edit name="family" mode="append"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test name="family"><string>sans-serif</string></test> + <edit name="family" mode="append"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test name="family"><string>monospace</string></test> + <edit name="family" mode="append"><string>Twemoji</string></edit> + </match> + + <!-- + If other fonts contain emoji glyphs, they could interfere and make some emojis rendered in wrong font (often in black-and-white). + For example, DejaVu Sans contains black-and-white emojis, which we can remove using the following trick: + --> + <match target="scan"> + <test name="family" compare="contains"> + <string>DejaVu</string> + </test> + <edit name="charset" mode="assign" binding="same"> + <minus> + <name>charset</name> + <charset> + <range> + <int>0x1f600</int> + <int>0x1f640</int> + </range> + </charset> + </minus> + </edit> + </match> + + <!-- + Recognize legacy ways of writing EmojiOne family name. + --> + <match target="pattern"> + <test qual="any" name="family"><string>EmojiOne</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Emoji One</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>EmojiOne Color</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>EmojiOne Mozilla</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <!-- + Use Twemoji when other popular fonts are being specifically requested. + + It is quite common that websites would only request Apple and Google emoji fonts. + These aliases will make Twemoji be selected in such cases to provide good-looking emojis. + + This obviously conflicts with other emoji fonts if you have them installed. + --> + <match target="pattern"> + <test qual="any" name="family"><string>Apple Color Emoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Segoe UI Emoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Segoe UI Symbol</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Noto Color Emoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>NotoColorEmoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Android Emoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Noto Emoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Twitter Color Emoji</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>JoyPixels</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Twemoji Mozilla</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>TwemojiMozilla</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>EmojiTwo</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Emoji Two</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>EmojiSymbols</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> + + <match target="pattern"> + <test qual="any" name="family"><string>Symbola</string></test> + <edit name="family" mode="assign" binding="same"><string>Twemoji</string></edit> + </match> +</fontconfig> diff --git a/media-fonts/twemoji/files/noto-build-all-flags.patch b/media-fonts/twemoji/files/noto-build-all-flags.patch new file mode 100644 index 000000000..564b08a59 --- /dev/null +++ b/media-fonts/twemoji/files/noto-build-all-flags.patch @@ -0,0 +1,11 @@ +--- old/Makefile 2018-05-03 20:32:14.000000000 +0200 ++++ new/Makefile 2018-05-08 11:48:20.811073447 +0200 +@@ -78,7 +78,7 @@ + + ALL_FLAGS = $(basename $(notdir $(wildcard $(FLAGS_SRC_DIR)/*.png))) + +-FLAGS = $(SELECTED_FLAGS) ++FLAGS = $(ALL_FLAGS) + + FLAG_NAMES = $(FLAGS:%=%.png) + FLAG_FILES = $(addprefix $(FLAGS_DIR)/, $(FLAG_NAMES)) diff --git a/media-fonts/twemoji/files/noto-build-path.patch b/media-fonts/twemoji/files/noto-build-path.patch new file mode 100644 index 000000000..151f88251 --- /dev/null +++ b/media-fonts/twemoji/files/noto-build-path.patch @@ -0,0 +1,11 @@ +--- a/add_glyphs.py.old 2018-11-18 11:11:56.387323302 +0100 ++++ b/add_glyphs.py 2018-11-18 11:12:18.203529159 +0100 +@@ -22,7 +22,7 @@ + import add_emoji_gsub + import add_aliases + +-sys.path.append( ++sys.path.insert(0, + path.join(os.path.dirname(__file__), 'third_party', 'color_emoji')) + from png import PNG + diff --git a/media-fonts/twemoji/files/noto-pngquant-verbose.patch b/media-fonts/twemoji/files/noto-pngquant-verbose.patch new file mode 100644 index 000000000..8a152bea2 --- /dev/null +++ b/media-fonts/twemoji/files/noto-pngquant-verbose.patch @@ -0,0 +1,11 @@ +--- a/Makefile~ 2020-04-22 23:04:44.000000000 +0200 ++++ b/Makefile 2020-04-22 23:06:42.069275340 +0200 +@@ -20,7 +20,7 @@ + + PNGQUANT = pngquant + PYTHON = python3 +-PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force ++PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force -v + BODY_DIMENSIONS = 136x128 + IMOPS := -size $(BODY_DIMENSIONS) canvas:none -compose copy -gravity center + diff --git a/media-fonts/twemoji/files/noto-use-gm.patch b/media-fonts/twemoji/files/noto-use-gm.patch new file mode 100644 index 000000000..6b51d0f52 --- /dev/null +++ b/media-fonts/twemoji/files/noto-use-gm.patch @@ -0,0 +1,27 @@ +--- a/Makefile~ 2019-03-28 17:45:53.000000000 +0100 ++++ b/Makefile 2019-06-02 10:36:55.587055453 +0200 +@@ -21,7 +21,7 @@ + PNGQUANT = pngquant + PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force + BODY_DIMENSIONS = 136x128 +-IMOPS := -size $(BODY_DIMENSIONS) canvas:none -compose copy -gravity center ++IMOPS = -size 136x128 -background none -gravity center -extent 136x128 -compose copy + + # zopflipng is better (about 5-10%) but much slower. it will be used if + # present. pass ZOPFLIPNG= as an arg to make to use optipng instead. +@@ -165,13 +165,13 @@ + # imagemagick packaged with ubuntu trusty (6.7.7-10) by using -composite. + + $(EMOJI_DIR)/%.png: $(EMOJI_SRC_DIR)/%.png | $(EMOJI_DIR) +- @convert $(IMOPS) "$<" -composite "PNG32:$@" ++ @gm convert $(IMOPS) "$<" "PNG32:$@" + + $(FLAGS_DIR)/%.png: $(FLAGS_SRC_DIR)/%.png ./waveflag | $(FLAGS_DIR) + @./waveflag $(FLAGS_DIR)/ "$<" + + $(RESIZED_FLAGS_DIR)/%.png: $(FLAGS_DIR)/%.png | $(RESIZED_FLAGS_DIR) +- @convert $(IMOPS) "$<" -composite "PNG32:$@" ++ @gm convert $(IMOPS) "$<" "PNG32:$@" + + flag-symlinks: $(RESIZED_FLAG_FILES) | $(RENAMED_FLAGS_DIR) + @$(subst ^, , \ diff --git a/media-fonts/twemoji/metadata.xml b/media-fonts/twemoji/metadata.xml new file mode 100644 index 000000000..4092a19fc --- /dev/null +++ b/media-fonts/twemoji/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>cyber+gentoo@sysrq.in</email> + <name>Anna</name> + </maintainer> + <upstream> + <remote-id type="github">twitter/twemoji</remote-id> + </upstream> +</pkgmetadata> diff --git a/media-fonts/twemoji/twemoji-13.1.0.ebuild b/media-fonts/twemoji/twemoji-13.1.0.ebuild new file mode 100644 index 000000000..dd8495937 --- /dev/null +++ b/media-fonts/twemoji/twemoji-13.1.0.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python3_{8..10} ) + +inherit font python-any-r1 + +NOTO_PV="2.034" +DESCRIPTION="A color emoji font with a flat visual style, designed and used by Twitter" +HOMEPAGE="https://twemoji.twitter.com" +SRC_URI="https://github.com/googlefonts/noto-emoji/archive/refs/tags/v${NOTO_PV}.tar.gz -> ${P}-noto.tar.gz + https://github.com/twitter/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/noto-emoji-${NOTO_PV}" + +LICENSE="Apache-2.0 CC-BY-4.0 MIT OFL-1.1" +SLOT="0" +KEYWORDS="~amd64" + +BDEPEND=" + ${PYTHON_DEPS} + app-arch/zopfli + $(python_gen_any_dep ' + >=dev-python/fonttools-4.7.0[${PYTHON_USEDEP}] + >=dev-python/nototools-0.2.13[${PYTHON_USEDEP}] + ') + media-gfx/pngquant + x11-libs/cairo + || ( media-gfx/imagemagick[png] media-gfx/graphicsmagick[png] ) +" + +RESTRICT="binchecks strip" + +DOCS=( CONTRIBUTING.md FOLDERS.md LEGACY.md README.md ) + +PATCHES=( + # https://github.com/googlei18n/noto-emoji/issues/240 + "${FILESDIR}"/noto-build-path.patch + # Be more verbose + "${FILESDIR}"/noto-pngquant-verbose.patch + +) + +FONT_S="${S}" +FONT_SUFFIX="ttf" +FONT_CONF=( "${FILESDIR}"/75-${PN}.conf ) + +python_check_deps() { + has_version -b "dev-python/fonttools[${PYTHON_USEDEP}]" && + has_version -b "dev-python/nototools[${PYTHON_USEDEP}]" +} + +pkg_setup() { + font_pkg_setup +} + +src_unpack() { + default + + mv "${WORKDIR}"/${P}/assets "${S}" || die + mv "${WORKDIR}"/${P}/*.md "${S}" || die +} + +src_prepare() { + default + + # Be more verbose + sed -i -e 's:\(@$(ZOPFLIPNG) -y "$<" "$@"\) 1> /dev/null 2>&1:\1:g' Makefile || die + + # Based on Fedora patch to allow graphicsmagick usage + if has_version -b media-gfx/graphicsmagick; then + eapply "${FILESDIR}/noto-use-gm.patch" + fi + + sed NotoColorEmoji.tmpl.ttx.tmpl \ + -e "s/Noto Color Emoji/${PN^}/" \ + -e "s/NotoColorEmoji/${PN^}/" \ + -e "s/Copyright .* Google Inc\./Twitter, Inc and other contributors./" \ + -e "s/ Version .*/ ${PV}/" \ + -e "s/.*is a trademark.*//" \ + -e "s/Google, Inc\./Twitter, Inc and other contributors/" \ + -e "s,http://www.google.com/get/noto/,https://twemoji.twitter.com," \ + -e "s/.*is licensed under.*/ Creative Commons Attribution 4.0 International/" \ + -e "s,http://scripts.sil.org/OFL,http://creativecommons.org/licenses/by/4.0/," \ + > ${PN^}.tmpl.ttx.tmpl || die + + pushd assets/72x72 || die + for png in *.png; do + mv ${png} emoji_u${png//-/_} || die + done +} + +src_compile() { + python_setup + einfo "Building fonts..." + + emake EMOJI=${PN^} EMOJI_SRC_DIR="assets/72x72" \ + FLAGS= BODY_DIMENSIONS=76x72 \ + BYPASS_SEQUENCE_CHECK=true \ + VIRTUAL_ENV=true +} + +src_install() { + rm NotoColorEmoji_WindowsCompatible.ttf *.tmpl.ttf || die + + # Don't lose fancy emoji icons + insinto /usr/share/icons/${PN}/72/emotes/ + doins assets/72x72/*.png + + insinto /usr/share/icons/${PN}/scalable/emotes/ + doins assets/svg/*.svg + + font_src_install + + einstalldocs +} |