Package: python3-qtawesome
Version: 1.2.1+dfsg-2
Severity: normal
X-Debbugs-Cc: Bastian Germann <b...@debian.org>

Hi Bastian,

I just noticed that you solved a test failure by skipping the test.
Having a look at the test in detail, it says "Please see PR #98 for
more details on why it is necessary..."; looking at
https://github.com/spyder-ide/qtawesome/pull/98 we see that bad
problems might result if there are duplicated font names.

I think a solution may be to do the following:

* Remove the forkawesome links from
  debian/python-qtawesome-common.links

* Copy the forkawesome font file three times, and modify the fontname
  of each one using https://github.com/chrissimpkins/fontname.py
  (requires a build-depends on python3-fonttools)

* Remove the fontawesome5-*charmap.json files from the orig tarball,
  as they're probably not DFSG-free either.  (I presume they come from
  the same non-DFSG source as the fonts themselves.)

* Create new fontawesome5-*charmap.json files from
  /usr/share/fonts-fork-awesome/css/v5-compat.css  Below is a quick
  script to do this.

That way, the font test can be reintroduced, and the charmaps only
represent the icons actually available.

Best wishes,

   Julian


#!/usr/bin/python3

"""Create JSON files for ForkAwesome font.

Copyright 2023 Julian Gilbey <j...@debian.org>
Licensed under the Expat license
"""

import json
import re

CSS = "/usr/share/fonts-fork-awesome/css/v5-compat.css"

JSONS = {
    "r": "fontawesome5-regular-webfont-charmap.json",
    "s": "fontawesome5-solid-webfont-charmap.json",
    "b": "fontawesome5-brands-webfont-charmap.json"
}

icons: dict[str, dict[str, str]] = {"r": {}, "s": {}, "b": {}}

icon_line = re.compile(r"\.fa([rsb])\.(.*):before")

with open(CSS) as css:
    while line := css.readline():
        if icon_match := icon_line.match(line):
            category, icon = icon_match.groups()
            content = css.readline()
            content = content.strip()
            char = content.removeprefix('content: "\\').removesuffix('";')
            icons[category][icon] = char

for category, filename in JSONS.items():
    with open(filename, "w") as catfile:
        json.dump(icons[category], catfile, indent=4)

Reply via email to