Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package hxtools for openSUSE:Factory checked in at 2021-08-03 22:49:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hxtools (Old) and /work/SRC/openSUSE:Factory/.hxtools.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hxtools" Tue Aug 3 22:49:09 2021 rev:42 rq:910042 version:20210803 Changes: -------- --- /work/SRC/openSUSE:Factory/hxtools/hxtools.changes 2020-11-17 21:25:19.773380434 +0100 +++ /work/SRC/openSUSE:Factory/.hxtools.new.1899/hxtools.changes 2021-08-03 22:49:45.420423316 +0200 @@ -1,0 +2,8 @@ +Tue Aug 3 19:51:22 UTC 2021 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 20210803 + * vfontas: read support for BDF + * kbd: cp437x.uni learned a few Unicode codepoints for checkmarks + (This is a Unicode glyph map for use with all cp437 fonts) + +------------------------------------------------------------------- Old: ---- hxtools-20201116.tar.asc hxtools-20201116.tar.xz New: ---- hxtools-20210803.tar.asc hxtools-20210803.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hxtools.spec ++++++ --- /var/tmp/diff_new_pack.lE7t9D/_old 2021-08-03 22:49:45.828422824 +0200 +++ /var/tmp/diff_new_pack.lE7t9D/_new 2021-08-03 22:49:45.828422824 +0200 @@ -17,7 +17,7 @@ Name: hxtools -Version: 20201116 +Version: 20210803 Release: 0 Summary: Collection of day-to-day tools (binaries) License: GPL-2.0+ and WTFPL ++++++ hxtools-20201116.tar.xz -> hxtools-20210803.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/NEWS.rst new/hxtools-20210803/NEWS.rst --- old/hxtools-20201116/NEWS.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/hxtools-20210803/NEWS.rst 2021-08-03 22:49:45.972422651 +0200 @@ -0,0 +1 @@ +symbolic link to doc/changelog.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/NEWS.txt new/hxtools-20210803/NEWS.txt --- old/hxtools-20201116/NEWS.txt 2021-08-03 22:49:45.964422660 +0200 +++ new/hxtools-20210803/NEWS.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to doc/NEWS.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/configure new/hxtools-20210803/configure --- old/hxtools-20201116/configure 2020-11-16 00:15:04.351715651 +0100 +++ new/hxtools-20210803/configure 2021-08-03 21:25:16.096718702 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for hxtools 20201116. +# Generated by GNU Autoconf 2.69 for hxtools 20210803. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='hxtools' PACKAGE_TARNAME='hxtools' -PACKAGE_VERSION='20201116' -PACKAGE_STRING='hxtools 20201116' +PACKAGE_VERSION='20210803' +PACKAGE_STRING='hxtools 20210803' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1301,7 +1301,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures hxtools 20201116 to adapt to many kinds of systems. +\`configure' configures hxtools 20210803 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1367,7 +1367,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of hxtools 20201116:";; + short | recursive ) echo "Configuration of hxtools 20210803:";; esac cat <<\_ACEOF @@ -1486,7 +1486,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -hxtools configure 20201116 +hxtools configure 20210803 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1946,7 +1946,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by hxtools $as_me 20201116, which was +It was created by hxtools $as_me 20210803, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2811,7 +2811,7 @@ # Define the identity of the package. PACKAGE='hxtools' - VERSION='20201116' + VERSION='20210803' cat >>confdefs.h <<_ACEOF @@ -4497,7 +4497,7 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \ -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \ -Winline -pipe -std=gnu11" -regular_CXXFLAGS="-Wall -Wno-pointer-arith -Wshadow -pipe -std=gnu++11" +regular_CXXFLAGS="-Wall -Wno-pointer-arith -Wshadow -pipe -std=gnu++17" @@ -5975,7 +5975,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by hxtools $as_me 20201116, which was +This file was extended by hxtools $as_me 20210803, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6041,7 +6041,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -hxtools config.status 20201116 +hxtools config.status 20210803 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/configure.ac new/hxtools-20210803/configure.ac --- old/hxtools-20201116/configure.ac 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/configure.ac 2021-08-03 21:24:36.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([hxtools], [20201116]) +AC_INIT([hxtools], [20210803]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_PROG_INSTALL @@ -12,7 +12,7 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \ -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \ -Winline -pipe -std=gnu11" -regular_CXXFLAGS="-Wall -Wno-pointer-arith -Wshadow -pipe -std=gnu++11" +regular_CXXFLAGS="-Wall -Wno-pointer-arith -Wshadow -pipe -std=gnu++17" AC_SUBST([regular_CPPFLAGS]) AC_SUBST([regular_CFLAGS]) AC_SUBST([regular_CXXFLAGS]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/data/gitconfig new/hxtools-20210803/data/gitconfig --- old/hxtools-20201116/data/gitconfig 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/data/gitconfig 2021-08-03 21:24:36.000000000 +0200 @@ -26,6 +26,7 @@ br = branch ci = commit co = checkout + cp = cherry-pick dc = diff --cached lg = log --oneline rc = rebase --continue diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/data/hxtools_bashrc.bash new/hxtools-20210803/data/hxtools_bashrc.bash --- old/hxtools-20201116/data/hxtools_bashrc.bash 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/data/hxtools_bashrc.bash 2021-08-03 21:24:36.000000000 +0200 @@ -72,13 +72,13 @@ local wd; ( IFS="/"; - pw2="$PWD/"; + wd="$PWD/" # Special treatment for homedir, as ~ is cheaper (shorter) than # the full home path ($HOME) - wd=${pw2/#$HOME\//~\/}; + wd=${wd/#$HOME\//~\/} wd=${wd%/}; set $wd; - if [ \( -z "$1" -a $# -le "$[$HXPREF_BEAUTIFY_PATH_LEVEL+1]" \) -o $# -le \ + if [ \( -z "$1" -a $# -le "$[$HXPREF_BEAUTIFY_PATH_LEVEL]" \) -o $# -le \ "$HXPREF_BEAUTIFY_PATH_LEVEL" ]; then echo "$wd"; else @@ -106,7 +106,7 @@ export PS1_ROOT="$PS1_XTERM\A \h:\$(hxpref_beautify_path) # "; export PS1_USER="$PS1_XTERM\A \h:\$(hxpref_beautify_path) \$ "; export PS1_XROOT="$PS1_XTERM\[\e[0;1;30m\]\A \[\e[0;31m\]\h:\$(hxpref_beautify_path) \[\e[1m\]#\[\e[0m\] "; -export PS1_XUSER="$PS1_XTERM\[\e[0;1;30m\]\A \[\e[0;32m\]\h:\$(hxpref_beautify_path) \[\e[0;1m\]\$\[\e[0m\] "; +export PS1_XUSER="$PS1_XTERM\[\e[0;1;30m\]\A \[\e[0;32m\]\h:\$(hxpref_beautify_path) \[\e[0;1;37m\]\$\[\e[0m\] "; unset PS1_XTERM eval "$(/usr/bin/dircolors -b /usr/share/hxtools/hxtools_dircolors)"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/doc/NEWS.txt new/hxtools-20210803/doc/NEWS.txt --- old/hxtools-20201116/doc/NEWS.txt 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/doc/NEWS.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,76 +0,0 @@ -rel-20201116 -============ -* pegrep: cure uninitialized variable warnings -* gpsh: change tmp location to /var/tmp - (avoid saving potentially large files to tmpfs) -* sysinfo: fix null deref when /etc/os-release is absent - - -rel-20200712 -============ -* profile: add QUILT_COLORS -* bsvplay: Pianoman MUS support -* pcmmix: new utility for arpeggio/polyphonic mixing of - bsvplay/qplay outputs - - -rel-20200428 -============ -* vfontas: N2 vectorizer: cease smoothing of stub serifs - (concerns the topleft corner of an 'E' in some fonts) -* vfontas: N2 vectorizer: avoid diagonalizing "pimples" in font outlines - (concerns 1-pixel protrusions in the right vertical edge of the '4') - - -rel-20200331 -============ -* vfontas: add new N2 vectorizer -* vfontas: new -saven2 command to use N2 - -The N2 vectorizer is able to recognize logical 45-degree angles in -bitmap glyphs and will output the outlines as such. Unlike N1, -it analyzes glyph outlines rather than pixel patterns, and produces -higher quality output due to a larger working radius. - -N2 can reproduce the "Nouveau IBM" font quite closely now (e.g. from -Fontraption's VGA9.F16 file). A few differences have just become apparent (one -can inspect in e.g. Inkscape by overlaying both fontfaces) that may be -addressed in a later release. - -N2: -* Isthmuses tend to get washed out, noticable in glyphs like 'G'. -* Sumps in the 'K', 'M', 'N' glyphs could be improved. - This is noticable in glyphs like 'G'. - -Nouveau IBM: -* Kerning is not original: too closely spaced. -* Node points are not at pixel or half-pixel locations. - 'B' has a 30.78 diagonal for no apparent reason. This is bad for integral - scaling. Other values can be observed in 'W'. -* Glyph 'C' is asymmetric. - - -rel-20200309 -============ -* vfontas: add N1 vectorizer -* vfontas: new -saven1 command to use N1 -* vfontas: remove -xbrz - - - -rel-20200124 -============ -* vfontas: add full vectorizer for SFD glyphs -* vfontas: improved ascent/descent values for vector output -* vfontas: hex format misreading was fixed - - -rel-20190428 -============ -* vfontas: new implementation. Replaces clt2bdf, clt2pbm, cltxscale, fnt2bdf. -* vfontas: xBRZ x6 support -* profile: use new GREP_COLORS variable - - -rel-20180301 -==== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/doc/changelog.rst new/hxtools-20210803/doc/changelog.rst --- old/hxtools-20201116/doc/changelog.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/hxtools-20210803/doc/changelog.rst 2021-08-03 21:24:36.000000000 +0200 @@ -0,0 +1,88 @@ +rel-20210803 +============ +Enhancements: +* vfontas: read support for BDF +* kbd: cp437x.uni learned a few Unicode codepoints for checkmarks + (cp437x is a glyph mapping table for arbitrary CP437 fonts + that declares some extra mappings to display more Unicode + characters somehow, rather than not showing them with a blank/box character) + + +rel-20201116 +============ +* pegrep: cure uninitialized variable warnings +* gpsh: change tmp location to /var/tmp + (avoid saving potentially large files to tmpfs) +* sysinfo: fix null deref when /etc/os-release is absent + + +rel-20200712 +============ +* profile: add QUILT_COLORS +* bsvplay: Pianoman MUS support +* pcmmix: new utility for arpeggio/polyphonic mixing of + bsvplay/qplay outputs + + +rel-20200428 +============ +* vfontas: N2 vectorizer: cease smoothing of stub serifs + (concerns the topleft corner of an 'E' in some fonts) +* vfontas: N2 vectorizer: avoid diagonalizing "pimples" in font outlines + (concerns 1-pixel protrusions in the right vertical edge of the '4') + + +rel-20200331 +============ +* vfontas: add new N2 vectorizer +* vfontas: new -saven2 command to use N2 + +The N2 vectorizer is able to recognize logical 45-degree angles in +bitmap glyphs and will output the outlines as such. Unlike N1, +it analyzes glyph outlines rather than pixel patterns, and produces +higher quality output due to a larger working radius. + +N2 can reproduce the "Nouveau IBM" font quite closely now (e.g. from +Fontraption's VGA9.F16 file). A few differences have just become apparent (one +can inspect in e.g. Inkscape by overlaying both fontfaces) that may be +addressed in a later release. + +N2: + +* Isthmuses tend to get washed out, noticable in glyphs like 'G'. +* Sumps in the 'K', 'M', 'N' glyphs could be improved. + This is noticable in glyphs like 'G'. + +Nouveau IBM: + +* Kerning is not original: too closely spaced. +* Node points are not at pixel or half-pixel locations. + 'B' has a 30.78 diagonal for no apparent reason. This is bad for integral + scaling. Other values can be observed in 'W'. +* Glyph 'C' is asymmetric. + + +rel-20200309 +============ +* vfontas: add N1 vectorizer +* vfontas: new -saven1 command to use N1 +* vfontas: remove -xbrz + + + +rel-20200124 +============ +* vfontas: add full vectorizer for SFD glyphs +* vfontas: improved ascent/descent values for vector output +* vfontas: hex format misreading was fixed + + +rel-20190428 +============ +* vfontas: new implementation. Replaces clt2bdf, clt2pbm, cltxscale, fnt2bdf. +* vfontas: xBRZ x6 support +* profile: use new GREP_COLORS variable + + +rel-20180301 +==== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/doc/lchain.rst new/hxtools-20210803/doc/lchain.rst --- old/hxtools-20201116/doc/lchain.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/hxtools-20210803/doc/lchain.rst 2021-08-03 21:24:36.000000000 +0200 @@ -0,0 +1,20 @@ +Avoiding loops and crossing edges in the final graph, which +directly results in a tree where you can follow the edges from +one author. + +Of course some SOB links will be lost, but that is the tradeoff. +What will definitely be retained is: + +* the author's existence and his attachment to one + subsystem s/he contributed, though probably not the one + with the major number of contributions + +* gatekeeper positions in the tree (but by chance only) + you can expect to find Andrew and Linus near the tree root + +What could be improved as I think about the issues... + +* count the number of submissions to a particular upstream + person and instead of longest-chaining, do "weighted-chaining"; + essentially stacking a contibutor into the subsystem he + contributed most to. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/doc/lchain.txt new/hxtools-20210803/doc/lchain.txt --- old/hxtools-20201116/doc/lchain.txt 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/doc/lchain.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -Avoiding loops and crossing edges in the final graph, which -directly results in a tree where you can follow the edges from -one author. - -Of course some SOB links will be lost, but that is the tradeoff. -What will definitely be retained is: - - - the author's existence and his attachment to one - subsystem s/he contributed, though probably not the one - with the major number of contributions - - - gatekeeper positions in the tree (but by chance only) - you can expect to find Andrew and Linus near the tree root - -What could be improved as I think about the issues... - - - count the number of submissions to a particular upstream - person and instead of longest-chaining, do "weighted-chaining"; - essentially stacking a contibutor into the subsystem he - contributed most to. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/doc/pcmmix.1 new/hxtools-20210803/doc/pcmmix.1 --- old/hxtools-20201116/doc/pcmmix.1 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/doc/pcmmix.1 2021-08-03 21:24:36.000000000 +0200 @@ -26,7 +26,7 @@ will be round-robined within, as p/q seconds. (default: 80/1086) .SH Examples .IP \(bu 4 -Entertainer from FOG: `pcmmix -t 160/1086 <(bsvplay --pianoman entrtan1.mus) <(bsvplay --pianoman entrtan2.mus) <(bsvplay --pianoman exe/entrtan3.mus) <(bsvplay --pianoman exe/entrtan4.mus) | aplay -fcd -r48000 -c1` +Entertainer from FOG: `pcmmix -t 160/1086 <(bsvplay --pianoman entrtan1.mus) <(bsvplay --pianoman entrtan2.mus) <(bsvplay --pianoman entrtan3.mus) <(bsvplay --pianoman entrtan4.mus) | aplay -fcd -r48000 -c1` .IP \(bu 4 IHOLD from FOG: `pcmmix -t 80/1086 <(bsvplay --pianoman ihold1.mus) <(bsvplay --pianoman ihold2.mus) <(bsvplay --pianoman ihold3.mus) <(bsvplay --pianoman ihold4.mus) | aplay -fcd -r48000 -c1` .SH See also diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/examples/colortable new/hxtools-20210803/examples/colortable --- old/hxtools-20201116/examples/colortable 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/examples/colortable 2021-08-03 21:24:36.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/perl # Display the ANSI color table -if ($ENV{TERM} eq "xterm") { +if ($ENV{TERM} =~ /^(\w+\.)?xterm/) { for (my $b = 0; $b < 256; $b += 32) { for (my $g = 0; $g < 256; $g += 32) { for (my $r = 0; $r < 256; $r += 16) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/kbd/cp437AB.uni new/hxtools-20210803/kbd/cp437AB.uni --- old/hxtools-20201116/kbd/cp437AB.uni 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/kbd/cp437AB.uni 2021-08-03 21:24:36.000000000 +0200 @@ -262,7 +262,7 @@ 0xf8 U+00b0 U+00aa U+00ba 0xf9 U+00b3 0xfa U+00b7 -0xfb U+221a +0xfb U+221a U+2611 U+2713 U+2714 0xfc U+207f 0xfd U+00b2 0xfe U+fffd U+fffc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/kbd/cp437x.uni new/hxtools-20210803/kbd/cp437x.uni --- old/hxtools-20201116/kbd/cp437x.uni 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/kbd/cp437x.uni 2021-08-03 21:24:36.000000000 +0200 @@ -262,7 +262,7 @@ 0xf8 U+00b0 U+00aa U+00ba 0xf9 U+2219 0xfa U+00b7 -0xfb U+221a +0xfb U+221a U+2611 U+2713 U+2714 0xfc U+207f 0xfd U+00b2 0xfe U+25a0 U+fffd U+fffc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/smm/gpsh new/hxtools-20210803/smm/gpsh --- old/hxtools-20201116/smm/gpsh 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/smm/gpsh 2021-08-03 21:24:36.000000000 +0200 @@ -269,7 +269,12 @@ return $ifile; } } - system "mkvmerge", "-o", $ofile, $ifile; + my $ret = system("mkvmerge", "-o", $ofile, $ifile); + if ($ret == -1) { + print "\e[31m", "mkvmerge was not found.", "\e[0m\n"; + } elsif ($ret != 0) { + print "mkvmerge failed to run.\n"; + } return $ofile; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/smm/vfalib.cpp new/hxtools-20210803/smm/vfalib.cpp --- old/hxtools-20201116/smm/vfalib.cpp 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/smm/vfalib.cpp 2021-08-03 21:24:36.000000000 +0200 @@ -199,6 +199,154 @@ m_glyph[k].lge(); } +struct bdfglystate { + int uc = -1, w = 0, h = 0, of_left = 0, of_baseline = 0; + unsigned int dwidth = 0, lr = 0; + unsigned int font_ascent = 0, font_descent = 0, font_height = 0; + std::string buf; + + void reset() { + w = h = of_left = of_baseline = dwidth = lr = 0; + uc = -1; + buf.clear(); + } +}; + +static size_t hexrunparse(void *vdest, size_t destsize, const char *p) +{ + auto dest = static_cast<uint8_t *>(vdest); + size_t written = 0; + while (destsize > 0) { + auto c = HX_tolower(*p++); + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'a' && c <= 'f') + c = c - 'a' + 10; + else + break; + auto d = HX_tolower(*p++); + if (d >= '0' && d <= '9') + d -= '0'; + else if (d >= 'a' && d <= 'f') + d = d - 'a' + 10; + else + break; + *dest++ = (c << 4) | d; + ++written; + } + return written; +} + +static void bdfbitparse(bdfglystate &cchar, const char *line) +{ + auto offset = cchar.buf.size(); + auto bpl = (cchar.w + 7) / 8; + cchar.buf.resize(offset + bpl); + auto z = hexrunparse(cchar.buf.data() + offset, bpl, line); + cchar.buf.resize(offset + z); +} + +static glyph bdfcomplete(const bdfglystate &cchar) +{ + vfsize bbx_size(cchar.w, cchar.h); + auto g = glyph::create_from_rpad(bbx_size, cchar.buf.c_str(), bytes_per_glyph(bbx_size)); + vfrect src_rect, dst_rect; + src_rect.x = cchar.of_left >= 0 ? 0 : -cchar.of_left; + src_rect.w = cchar.of_left >= 0 ? cchar.w : std::max(0, cchar.w + cchar.of_left); + src_rect.y = 0; + src_rect.h = cchar.h; + dst_rect.x = std::max(0, cchar.of_left); + dst_rect.y = std::max(0, static_cast<int>(cchar.font_ascent) - cchar.of_baseline - cchar.h); + dst_rect.w = cchar.dwidth; + dst_rect.h = cchar.font_height; + return g.blit(src_rect, dst_rect); +} + +int font::load_bdf(const char *filename) +{ + enum { BDF_NONE, BDF_FONT, BDF_CHAR, BDF_BITMAP, BDF_PASTBITMAP, BDF_DONE }; + std::unique_ptr<FILE, deleter> fp(fopen(filename, "r")); + if (fp == nullptr) + return -errno; + if (m_unicode_map == nullptr) + m_unicode_map = std::make_shared<unicode_map>(); + + hxmc_t *line = nullptr; + auto lineclean = make_scope_success([&]() { HXmc_free(line); }); + unsigned int state = BDF_NONE; + bdfglystate cchar; + + while (HX_getl(&line, fp.get()) != nullptr) { + if (state == BDF_NONE) { + if (strncmp(line, "STARTFONT 2.1\n", 14) == 0) { + state = BDF_FONT; + continue; + } + } else if (state == BDF_FONT) { + if (strcmp(line, "ENDFONT") == 0) + break; + if (strncmp(line, "STARTCHAR ", 10) == 0) { + cchar.reset(); + cchar.font_height = cchar.font_ascent + cchar.font_descent; + state = BDF_CHAR; + continue; + } + auto fields = sscanf(line, "FONT_ASCENT %u", &cchar.font_ascent); + if (fields == 1) + continue; + fields = sscanf(line, "FONT_DESCENT %u", &cchar.font_descent); + if (fields == 1) + continue; + } else if (state == BDF_CHAR) { + int tmp = -1; + auto fields = sscanf(line, "ENCODING %d %d", &tmp, &cchar.uc); + if (fields == 2 && tmp == -1) { + continue; + } else if (fields == 1 && tmp == -1) { + state = BDF_PASTBITMAP; + continue; + } else if (fields == 1) { + cchar.uc = tmp; + continue; + } + fields = sscanf(line, "DWIDTH %d", &cchar.dwidth); + if (fields == 1) + continue; + /* only supporting Writing Mode 0 right now */ + fields = sscanf(line, "BBX %d %d %d %d", &cchar.w, &cchar.h, &cchar.of_left, &cchar.of_baseline); + if (fields == 4) { + cchar.lr = cchar.h; + continue; + } + if (strcmp(line, "BITMAP\n") == 0) { + state = cchar.lr == 0 ? BDF_PASTBITMAP : BDF_BITMAP; + continue; + } + } else if (state == BDF_BITMAP) { + if (cchar.lr == 0) { + state = BDF_PASTBITMAP; + continue; + } + if (cchar.lr-- > 0) + bdfbitparse(cchar, line); + if (cchar.lr == 0) { + state = BDF_PASTBITMAP; + continue; + } + } else if (state == BDF_PASTBITMAP) { + if (strcmp(line, "ENDCHAR\n") == 0) { + if (cchar.uc != -1) { + m_unicode_map->add_i2u(m_glyph.size(), cchar.uc); + m_glyph.push_back(bdfcomplete(std::move(cchar))); + } + state = BDF_FONT; + continue; + } + } + } + return 0; +} + int font::load_clt(const char *dirname) { std::unique_ptr<HXdir, deleter> dh(HXdir_open(dirname)); @@ -311,33 +459,16 @@ continue; ++end; - unsigned int z; char gbits[32]{}; HX_chomp(line); - for (z = 0; z < sizeof(gbits) && end[0] != '\0' && end[1] != '\0'; - ++z, end += 2) { - gbits[z] = 0; - auto c = HX_tolower(end[0]); - if (c >= '0' && c <= '9') - gbits[z] = c - '0'; - else if (HX_tolower(end[0]) >= 'a' && HX_tolower(end[0]) <= 'f') - gbits[z] = c - 'a' + 10; - gbits[z] <<= 4; - c = HX_tolower(end[1]); - if (c >= '0' && c <= '9') - gbits[z] |= c - '0'; - else if (HX_tolower(end[1]) >= 'a' && HX_tolower(end[1]) <= 'f') - gbits[z] |= c - 'a' + 10; - } - + auto z = hexrunparse(gbits, ARRAY_SIZE(gbits), end); if (z == 16) m_glyph.emplace_back(glyph::create_from_rpad(vfsize(8, 16), gbits, z)); else if (z == 32) m_glyph.emplace_back(glyph::create_from_rpad(vfsize(16, 16), gbits, z)); else - fprintf(stderr, "load_hex: unrecognized glyph size (%u bytes) in line %zu\n", z, lnum); + fprintf(stderr, "load_hex: unrecognized glyph size (%zu bytes) in line %zu\n", z, lnum); m_unicode_map->add_i2u(m_glyph.size() - 1, cp); - m_unicode_map->add_u2i(cp, m_glyph.size() - 1); } HXmc_free(line); return 0; @@ -522,6 +653,7 @@ static_cast<unsigned int>(cp), static_cast<unsigned int>(cp)); fprintf(fp, "SWIDTH 1000 0\n"); fprintf(fp, "DWIDTH %u 0\n", sz.w); + /* sz.h/4 is just a guess as to the descent of glyphs */ fprintf(fp, "BBX %u %u 0 -%u\n", sz.w, sz.h, sz.h / 4); fprintf(fp, "BITMAP\n"); @@ -1263,6 +1395,10 @@ m_data.resize(bytes_per_glyph(m_size)); } +/* + * Create the in-memory representation (which is bitpacked) from a bytepacked + * ("right-padded") raw representation. + */ glyph glyph::create_from_rpad(const vfsize &size, const char *buf, size_t z) { glyph ng(size); @@ -1405,6 +1541,9 @@ return vec; } +/** + * Convert from bit-packed representation to row-padded. + */ std::string glyph::as_rowpad() const { std::string ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/smm/vfalib.hpp new/hxtools-20210803/smm/vfalib.hpp --- old/hxtools-20201116/smm/vfalib.hpp 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/smm/vfalib.hpp 2021-08-03 21:24:36.000000000 +0200 @@ -59,7 +59,6 @@ int load(const char *file); void add_i2u(unsigned int, char32_t); - void add_u2i(char32_t cp, unsigned int i) { add_i2u(i, cp); } std::set<char32_t> to_unicode(unsigned int idx) const; ssize_t to_index(char32_t uc) const; }; @@ -112,6 +111,7 @@ class font { public: void init_256_blanks(); + int load_bdf(const char *file); int load_clt(const char *dir); int load_fnt(const char *file, unsigned int height_hint = -1); int load_hex(const char *file); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20201116/smm/vfontas.cpp new/hxtools-20210803/smm/vfontas.cpp --- old/hxtools-20201116/smm/vfontas.cpp 2020-11-16 00:14:31.000000000 +0100 +++ new/hxtools-20210803/smm/vfontas.cpp 2021-08-03 21:24:36.000000000 +0200 @@ -130,6 +130,15 @@ return true; } +static bool vf_loadbdf(font &f, char **args) +{ + auto ret = f.load_bdf(args[0]); + if (ret >= 0) + return true; + fprintf(stderr, "Error loading %s: %s\n", args[0], strerror(-ret)); + return false; +} + static bool vf_loadclt(font &f, char **args) { auto ret = f.load_clt(args[0]); @@ -423,6 +432,7 @@ {"flipv", 0, vf_flipv}, {"invert", 0, vf_invert}, {"lge", 0, vf_lge}, + {"loadbdf", 1, vf_loadbdf}, {"loadclt", 1, vf_loadclt}, {"loadfnt", 1, vf_loadfnt}, {"loadfnth", 2, vf_loadfnth},