Subject: Re: bug#33729: 27.0.50; Partial glyphs not rendered for Gujarati with Harfbuzz enabled (renders fine using m17n)

From: Glenn Morris <[email-masked]>
Date: Sun, 16 Dec 2018 19:30:00 -0500

Eli Zaretskii wrote:

> After some thinking, my conclusion is that we should import the
> ISO 15924 database from https://unicode.org/iso15924/, use a script
> similar to admin/unidata/blocks.awk to generate an alist from it that
> maps Emacs script names to ISO 15924 tags, and then access that alist
> from uni_script to get the correct script information to Harfbuzz.
>
> Patches implementing that are welcome.

I live to write awk scripts. I'm not 100% sure what you want, but as a
first example, the following takes
http://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt
as input and outputs lines of the form "(gujr . gujarati)".

The aliases are so that the RHS matches charscript.el.

If this is not right, please clarify exactly what the inputs and output
should be.

#!/usr/bin/awk -f

function name2alias(name) {
    name = tolower(name)
    if (name ~ /arabic/) return "arabic"
    else if (name ~ /aramaic/) return "aramaic"
    else if (name ~ /cypriot/) return "cypriot-syllabary"
    else if (name ~ /katakana|hiragana/) return "kana"
    else if (name ~ /myanmar/) return "burmese"
    else if (name ~ /duployan|shorthand/) return "duployan-shorthand"
    else if (name ~ /signwriting/) return "sutton-sign-writing"
    sub(/^new_/, "", name)
    sub(/_(hieroglyphs|cursive)$/, "", name)
    gsub(/_/,"-",name)
    return name
}

$1 == "sc" {
    abbrev = tolower($3)
    alias = name2alias($5)
    if (alias ~ /^inherited|common|unknown/) next
    print "(" abbrev, ".", alias ")"
}