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-10-06 19:49:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hxtools (Old) and /work/SRC/openSUSE:Factory/.hxtools.new.2443 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hxtools" Wed Oct 6 19:49:48 2021 rev:43 rq:923345 version:20210928 Changes: -------- --- /work/SRC/openSUSE:Factory/hxtools/hxtools.changes 2021-08-03 22:49:45.420423316 +0200 +++ /work/SRC/openSUSE:Factory/.hxtools.new.2443/hxtools.changes 2021-10-06 19:49:52.308055867 +0200 @@ -1,0 +2,10 @@ +Tue Sep 28 19:25:52 UTC 2021 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 20210928 + * vfontas: add recognition for BDF glyphs as produced by + fontforge from PCF + * kbd: map beta to eszett on cp437x + * vfontas: recognize "idem" lines in kbd unimaps + * vfontas: add -setbold, -setprop, -lgeu, -lgeuf commands + +------------------------------------------------------------------- Old: ---- hxtools-20210803.tar.asc hxtools-20210803.tar.xz New: ---- hxtools-20210928.tar.asc hxtools-20210928.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hxtools.spec ++++++ --- /var/tmp/diff_new_pack.V63Ucd/_old 2021-10-06 19:49:52.880056084 +0200 +++ /var/tmp/diff_new_pack.V63Ucd/_new 2021-10-06 19:49:52.884056085 +0200 @@ -1,7 +1,7 @@ # # spec file for package hxtools # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: hxtools -Version: 20210803 +Version: 20210928 Release: 0 Summary: Collection of day-to-day tools (binaries) License: GPL-2.0+ and WTFPL @@ -278,7 +278,6 @@ %_mandir/man1/ofl.1* %files -n sysinfo -%defattr(-,root,root) %_bindir/pmap_dirty %_bindir/sysinfo %_mandir/man1/sysinfo.1* ++++++ hxtools-20210803.tar.xz -> hxtools-20210928.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/configure new/hxtools-20210928/configure --- old/hxtools-20210803/configure 2021-08-03 21:25:16.096718702 +0200 +++ new/hxtools-20210928/configure 2021-09-28 21:21:33.858614354 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for hxtools 20210803. +# Generated by GNU Autoconf 2.69 for hxtools 20210928. # # # 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='20210803' -PACKAGE_STRING='hxtools 20210803' +PACKAGE_VERSION='20210928' +PACKAGE_STRING='hxtools 20210928' 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 20210803 to adapt to many kinds of systems. +\`configure' configures hxtools 20210928 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 20210803:";; + short | recursive ) echo "Configuration of hxtools 20210928:";; esac cat <<\_ACEOF @@ -1486,7 +1486,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -hxtools configure 20210803 +hxtools configure 20210928 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 20210803, which was +It was created by hxtools $as_me 20210928, 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='20210803' + VERSION='20210928' cat >>confdefs.h <<_ACEOF @@ -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 20210803, which was +This file was extended by hxtools $as_me 20210928, 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 20210803 +hxtools config.status 20210928 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-20210803/configure.ac new/hxtools-20210928/configure.ac --- old/hxtools-20210803/configure.ac 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/configure.ac 2021-09-28 21:21:08.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([hxtools], [20210803]) +AC_INIT([hxtools], [20210928]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_PROG_INSTALL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/doc/bin2c.1 new/hxtools-20210928/doc/bin2c.1 --- old/hxtools-20210803/doc/bin2c.1 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/doc/bin2c.1 2021-09-28 21:21:08.000000000 +0200 @@ -1,4 +1,4 @@ -.TH bin2c "2013-09-29" "hxtools" "hxtools" +.TH bin2c 1 "2013-09-29" "hxtools" "hxtools" .SH Name .PP bin2c \(em embed data files into C as variables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/doc/changelog.rst new/hxtools-20210928/doc/changelog.rst --- old/hxtools-20210803/doc/changelog.rst 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/doc/changelog.rst 2021-09-28 21:21:08.000000000 +0200 @@ -1,3 +1,12 @@ +rel-20210928 +============ +Enhancements: +* vfontas: add recognition for BDF glyphs as produced by fontforge from PCF +* kbd: map beta to eszett on cp437x +* vfontas: recognize "idem" lines in kbd unimaps +* vfontas: add -setbold, -setprop, -lgeu, -lgeuf commands + + rel-20210803 ============ Enhancements: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/doc/pcmdiff.1 new/hxtools-20210928/doc/pcmdiff.1 --- old/hxtools-20210803/doc/pcmdiff.1 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/doc/pcmdiff.1 2021-09-28 21:21:08.000000000 +0200 @@ -8,7 +8,7 @@ .SH Description .PP pcmdiff will compute the arithmetic difference between the raw PCM files -\fIfile1\fP and \fIfile2\fP and write it to stdout. This allows to make the +\fIfile1\fP and \fIfile2\fP and write it to stdout. This allows one to make the degradation that inherently comes with lossy audio formats, audible. .SH Examples .PP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/doc/vfontas-formats.dot new/hxtools-20210928/doc/vfontas-formats.dot --- old/hxtools-20210803/doc/vfontas-formats.dot 1970-01-01 01:00:00.000000000 +0100 +++ new/hxtools-20210928/doc/vfontas-formats.dot 2021-09-28 21:21:08.000000000 +0200 @@ -0,0 +1,25 @@ +digraph { + bdf -> vfontas; + clt -> vfontas; + fntraw -> vfontas; + gnuhex -> vfontas; + psf1 -> vfontas; + psf2 -> vfontas; + unimap -> vfontas; + vfontas -> bdf; + vfontas -> clt; + vfontas -> fntraw; + vfontas -> pbm; + vfontas -> psf2; + vfontas -> sfd; + vfontas -> unimap; + bdf -> bdftopcf; + bdftopcf -> pcf; + bdf -> fontforge; + pcf -> fontforge; + sfd -> fontforge; + ttf -> fontforge; + fontforge -> bdf; + fontforge -> sfd; + fontforge -> ttf; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/doc/vfontas.1 new/hxtools-20210928/doc/vfontas.1 --- old/hxtools-20210803/doc/vfontas.1 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/doc/vfontas.1 2021-09-28 21:21:08.000000000 +0200 @@ -23,6 +23,12 @@ .PP \fB\-lge\fP .PP +\fB\-lgeu\fP +.PP +\fB\-lgeuf\fP +.PP +\fB\-loadbdf\fP \fIff.bdf\fP +.PP \fB\-loadclt\fP \fIdirectory/\fP .PP \fB\-loadfnt\fP \fImu.fnt\fP @@ -49,8 +55,12 @@ .PP \fB\-savesfd\fP \fInew.sfd\fP .PP +\fB\-setbold\fP +.PP \fB\-setname\fP \fIname\fP .PP +\fB\-setprop\fP \fIkey\fP \fIvalue\fP +.PP \fB\-upscale\fP \fIxscale\fP \fIyscale\fP .PP \fB\-xcpi\fP \fIega437.cpi\fP \fIoutdir/\fP @@ -59,8 +69,17 @@ .PP .SH Description .PP -vfontas (originally "VGA font file assembler") can transform raster font files -in various ways. +vfontas (originally "VGA font file assembler") can read/write bitmap fonts +from/to a number of formats and transform the glyphs in various ways. vfontas +is able to generate a vector format. +.PP +vfontas does not have a direct integration of or with FontForge, but thanks to +the BDF read/write support on both sides, fonts in formats like FNT and PSF can +be made available to FontForge by vfontas, and, conversely, fonts in formats +like FON and TTF can be made available to vfontas by FF. +.PP +With its own CLT format, vfontas makes glyphs in a textgraphical format to +facilitate editing with plain-text screen editors such as vi, nano, etc. .SH Aspect ratio .PP CRT screens of the time commonly had an aspect ratio of 4:3, and whatever @@ -195,8 +214,26 @@ .SS lge .PP Applies a "Line Graphics Enable" transformation on glyphs. It copies the pixels -in the second rightmost column to the rightmost column, and does this for glyph -indices 0xC0 to 0xDF. +in the second rightmost column to the rightmost column, and does this for +\fIglyph indices\fP 0xC0 to 0xDF. In other words, the usefulness of the \-lge +command is more or less limited to DOS fonts which have graphic characters in +exactly those indices. +.SS lgeu +.PP +Applies LGE on the graphic glyphs that are \fIin cp437\fP and other DOS +codepages. It does this for \fIunicode codepoints\fP rather than glyph indices. +This is suitable for all kinds of font formats, but do make sure a Unicode +table is present. (BDF and PSF come with a table, .fnt does not, so use +\-loadmap before \-lgeu). +.SS lgeuf +.PP +Applies LGE on \fIall\fP glyphs from U+2500 thru U+25FF (Unicode "box drawing" +and "box elements" classes), with special handling for the shades at U+2591 +thru U+2593. This is provided as an alternative to the "true DOS look" that +lge/lgeu would make. +.SS loadbdf +.PP +Reads a BDF (Adobe Glyph Bitmap Distribution Format) font file. .SS loadclt .PP Reads a directory full of CLT files containing glyphs. CLT is a textgraphical @@ -298,11 +335,17 @@ processed further by fontforge(1). A fairly trivial vectorizer is used that maps each pixels to a square and then collapses shared edges between those to reduce the number of polygons fontforge has to process. +.SS setbold +.PP +For BDF/SFD output: Declare the font as being bold. .SS setname .PP Sets a name for the font, which gets emitted for BDF/SFD output. (The other file formats have no metadata field for a name, so the filename is all you get.) +.SS setprop +.PP +Sets a specific property for SFD fonts (also partly used by BDF). .SS upscale .PP Performs a linear upscale by an integral factor for all glyphs. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/examples/cp437 new/hxtools-20210928/examples/cp437 --- old/hxtools-20210803/examples/cp437 1970-01-01 01:00:00.000000000 +0100 +++ new/hxtools-20210928/examples/cp437 2021-09-28 21:21:08.000000000 +0200 @@ -0,0 +1,21 @@ +#!/usr/bin/perl +# print the cp437 character table (used for font testing) + +use strict; +open(FH, "<../kbd/cp437x.uni") or die; +my @map; +while (<FH>) { + if (m{^#}) { next; } + my($src, $dst) = split(m{\s+}, $_); + $dst =~ s{U\+(\S+)}{chr(hex($1))}eg; + $map[hex($src)] = $dst; +} +close FH; +$map[0] = ' '; +binmode(STDOUT, ":utf8"); +for (my $y = 0; $y < 8; ++$y) { + for (my $x = 0; $x < 32; ++$x) { + print $map[$y*32+$x]; + } + print "\n"; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/kbd/cp437x.uni new/hxtools-20210928/kbd/cp437x.uni --- old/hxtools-20210803/kbd/cp437x.uni 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/kbd/cp437x.uni 2021-09-28 21:21:08.000000000 +0200 @@ -236,7 +236,7 @@ # Greek letters and mathematical symbols # 0xe0 U+03b1 -0xe1 U+03b2 U+00df +0xe1 U+00df U+03b2 U+00df 0xe2 U+0393 0xe3 U+03c0 0xe4 U+03a3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/sadmin/fd0ssh.c new/hxtools-20210928/sadmin/fd0ssh.c --- old/hxtools-20210803/sadmin/fd0ssh.c 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/sadmin/fd0ssh.c 2021-09-28 21:21:08.000000000 +0200 @@ -114,7 +114,7 @@ /* * Making the writer a subprocess makes for a very compact memory - * usage, allows to use no special signal setup, and even both + * usage, allows one to use no special signal setup, and even both * interactive and non-interactive work as expected, that is, if * mount.fuse detaches, so does the pipe writer with it. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/smm/qplay.c new/hxtools-20210928/smm/qplay.c --- old/hxtools-20210803/smm/qplay.c 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/smm/qplay.c 2021-09-28 21:21:08.000000000 +0200 @@ -303,7 +303,7 @@ ptr += parse_arg_x(ptr); break; default: - fprintf(stderr, "** Unkown command ignored: %c\n", *ptr); + fprintf(stderr, "** Unknown command ignored: %c\n", *ptr); break; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/smm/vfalib.cpp new/hxtools-20210928/smm/vfalib.cpp --- old/hxtools-20210803/smm/vfalib.cpp 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/smm/vfalib.cpp 2021-09-28 21:21:08.000000000 +0200 @@ -140,32 +140,42 @@ size_t lnum = 0; hxmc_t *line = nullptr; auto lineclean = make_scope_success([&]() { HXmc_free(line); }); + while (HX_getl(&line, fp.get()) != nullptr) { char *ptr = line, *end = nullptr; while (HX_isspace(*ptr)) ++ptr; if (*ptr == '#') continue; - auto key = strtoul(line, &end, 0); + HX_chomp(line); + int keyfrom = strtol(line, &end, 0), keyto = keyfrom; ++lnum; do { + if (*end == '-') + keyto = strtol(end + 1, &end, 0); ptr = end; while (HX_isspace(*ptr) || *ptr == '\r') ++ptr; if (*ptr == '\0' || *ptr == '\n' || *ptr == '#') break; - if (ptr[0] != 'U') { + if (strcmp(ptr, "idem") == 0) { + break; + } else if (ptr[0] != 'U') { fprintf(stderr, "Warning: Unexpected char '%c' in unicode map line %zu.\n", ptr[0], lnum); break; } else if (ptr[1] != '+') { fprintf(stderr, "Warning: Unexpected char '%c' in unicode map line %zu.\n", ptr[1], lnum); break; } + if (keyfrom != keyto) { + fprintf(stderr, "Warning: No support for ranged mappings (0x%x-0x%x here) for anything but \"idem\".\n", keyfrom, keyto); + break; + } ptr += 2; auto val = strtoul(ptr, &end, 16); if (end == ptr) break; - add_i2u(key, val); + add_i2u(keyfrom, val); } while (true); } return true; @@ -187,6 +197,16 @@ return j->second; } +font::font() : + props{ + {"FontName", "vfontas-output"}, + {"FamilyName", "vfontas output"}, + {"FullName", "vfontas output"}, + {"Weight", "medium"}, + {"TTFWeight", "500"}, + } +{} + void font::init_256_blanks() { m_glyph = std::vector<glyph>(256, glyph(vfsize(8, 16))); @@ -199,15 +219,59 @@ m_glyph[k].lge(); } +void font::lgeu() +{ + static constexpr uint16_t cand[] = { + /* + * It looks like cp{737,850,852,865,866} only have subsets + * of cp437's graphic characters. Therefore I did not bother + * checking cp{855,857,860,861,863,869}. + */ + 0x2500, 0x250c, 0x2514, 0x2518, 0x251c, 0x252c, 0x2534, 0x253c, + 0x2550, 0x2552, 0x2553, 0x2554, 0x2558, 0x2559, 0x255a, 0x255e, + 0x255f, 0x2560, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, + 0x256a, 0x256b, 0x256c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, + }; + if (m_unicode_map == nullptr) { + fprintf(stderr, "This font has no unicode map, can't perform LGEU command.\n"); + return; + } + auto &map = *m_unicode_map; + for (auto uc : cand) { + auto it = map.m_u2i.find(uc); + if (it != map.m_u2i.end()) + m_glyph[it->second].lge(); + } +} + +void font::lgeuf() +{ + if (m_unicode_map == nullptr) { + fprintf(stderr, "This font has no unicode map, can't perform LGEU command.\n"); + return; + } + auto &map = *m_unicode_map; + for (auto it = map.m_u2i.lower_bound(0x2500); + it != map.m_u2i.upper_bound(0x2591); ++it) + m_glyph[it->second].lge(); + for (auto it = map.m_u2i.lower_bound(0x2591); + it != map.m_u2i.upper_bound(0x2594); ++it) + m_glyph[it->second].lge(2); + for (auto it = map.m_u2i.lower_bound(0x2594); + it != map.m_u2i.upper_bound(0x2600); ++it) + m_glyph[it->second].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; + std::string name, buf; void reset() { w = h = of_left = of_baseline = dwidth = lr = 0; uc = -1; + name.clear(); buf.clear(); } }; @@ -288,6 +352,7 @@ if (strncmp(line, "STARTCHAR ", 10) == 0) { cchar.reset(); cchar.font_height = cchar.font_ascent + cchar.font_descent; + cchar.name = line + 10; state = BDF_CHAR; continue; } @@ -302,6 +367,11 @@ auto fields = sscanf(line, "ENCODING %d %d", &tmp, &cchar.uc); if (fields == 2 && tmp == -1) { continue; + } else if (fields == 1 && tmp == -1 && cchar.uc == -1 && + cchar.name.size() >= 2 && cchar.name[0] == 'C' && + HX_isdigit(cchar.name[1])) { + cchar.uc = strtoul(cchar.name.c_str() + 1, nullptr, 10); + continue; } else if (fields == 1 && tmp == -1) { state = BDF_PASTBITMAP; continue; @@ -595,28 +665,28 @@ vfsize sz0; if (m_glyph.size() > 0) sz0 = m_glyph[0].m_size; - std::string bfd_name = name; + std::string bfd_name = props["FullName"]; /* X logical font description (XLFD) does not permit dashes */ std::replace(bfd_name.begin(), bfd_name.end(), '-', ' '); fprintf(fp, "STARTFONT 2.1\n"); fprintf(fp, "FONT -misc-%s-medium-r-normal--%u-%u-75-75-c-%u-iso10646-1\n", - name.c_str(), sz0.h, 10 * sz0.h, 10 * sz0.w); + props["FontName"].c_str(), sz0.h, 10 * sz0.h, 10 * sz0.w); fprintf(fp, "SIZE %u 75 75\n", sz0.h); fprintf(fp, "FONTBOUNDINGBOX %u %u 0 -%u\n", sz0.w, sz0.h, sz0.h / 4); fprintf(fp, "STARTPROPERTIES 24\n"); fprintf(fp, "FONT_TYPE \"Bitmap\"\n"); fprintf(fp, "FONTNAME_REGISTRY \"\"\n"); fprintf(fp, "FOUNDRY \"misc\"\n"); - fprintf(fp, "FAMILY_NAME \"%s\"\n", name.c_str()); - fprintf(fp, "WEIGHT_NAME \"medium\"\n"); + fprintf(fp, "FAMILY_NAME \"%s\"\n", props["FamilyName"].c_str()); + fprintf(fp, "WEIGHT_NAME \"%s\"\n", props["Weight"].c_str()); fprintf(fp, "SLANT \"r\"\n"); fprintf(fp, "SETWIDTH_NAME \"normal\"\n"); fprintf(fp, "PIXEL_SIZE %u\n", sz0.h); fprintf(fp, "POINT_SIZE %u\n", 10 * sz0.h); fprintf(fp, "SPACING \"C\"\n"); fprintf(fp, "AVERAGE_WIDTH %u\n", 10 * sz0.w); - fprintf(fp, "FONT \"%s\"\n", name.c_str()); - fprintf(fp, "WEIGHT 10\n"); + fprintf(fp, "FONT \"%s\"\n", props["FullName"].c_str()); + fprintf(fp, "WEIGHT %s\n", props["TTFWeight"].c_str()); fprintf(fp, "RESOLUTION 75\n"); fprintf(fp, "RESOLUTION_X 75\n"); fprintf(fp, "RESOLUTION_Y 75\n"); @@ -842,21 +912,26 @@ return asds; } +static unsigned int ttfweight_to_panose(const char *s) +{ + unsigned int z = strtoul(s, nullptr, 0); + if (z >= 1 && z <= 999) + return 1 + z / 100; + return 6; +} + int font::save_sfd(const char *file, enum vectoalg vt) { std::unique_ptr<FILE, deleter> filep(fopen(file, "w")); if (filep == nullptr) return -errno; auto fp = filep.get(); - std::string ps_name = name; - /* PostScript name does not allow spaces */ - std::replace(ps_name.begin(), ps_name.end(), ' ', '-'); auto asds = find_ascent_descent(); fprintf(fp, "SplineFontDB: 3.0\n"); - fprintf(fp, "FontName: %s\n", ps_name.c_str()); - fprintf(fp, "FullName: %s\n", name.c_str()); - fprintf(fp, "FamilyName: %s\n", name.c_str()); - fprintf(fp, "Weight: medium\n"); + fprintf(fp, "FontName: %s\n", props["FontName"].c_str()); + fprintf(fp, "FullName: %s\n", props["FullName"].c_str()); + fprintf(fp, "FamilyName: %s\n", props["FamilyName"].c_str()); + fprintf(fp, "Weight: %s\n", props["Weight"].c_str()); fprintf(fp, "Version: 001.000\n"); fprintf(fp, "ItalicAngle: 0\n"); fprintf(fp, "UnderlinePosition: -3\n"); @@ -866,9 +941,9 @@ fprintf(fp, "NeedsXUIDChange: 1\n"); fprintf(fp, "FSType: 0\n"); fprintf(fp, "PfmFamily: 49\n"); - fprintf(fp, "TTFWeight: 500\n"); + fprintf(fp, "TTFWeight: %s\n", props["TTFWeight"].c_str()); fprintf(fp, "TTFWidth: 5\n"); - fprintf(fp, "Panose: 2 0 6 9 9 0 0 0 0 0\n"); + fprintf(fp, "Panose: 2 0 %u 9 9 0 0 0 0 0\n", ttfweight_to_panose(props["TTFWeight"].c_str())); fprintf(fp, "LineGap: 0\n"); fprintf(fp, "VLineGap: 0\n"); fprintf(fp, "OS2TypoAscent: %d\n", asds.first * vectorizer::scale_factor); @@ -1479,12 +1554,12 @@ std::transform(m_data.begin(), m_data.end(), m_data.begin(), [](char c) { return ~c; }); } -void glyph::lge() +void glyph::lge(unsigned int adj) { - if (m_size.w < 2) + if (m_size.w < adj + 1) return; for (unsigned int y = 0; y < m_size.h; ++y) { - bitpos ipos = (y + 1) * m_size.w - 2; + bitpos ipos = (y + 1) * m_size.w - 1 - adj; bitpos opos = (y + 1) * m_size.w - 1; if (m_data[ipos.byte] & ipos.mask) m_data[opos.byte] |= opos.mask; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/smm/vfalib.hpp new/hxtools-20210928/smm/vfalib.hpp --- old/hxtools-20210803/smm/vfalib.hpp 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/smm/vfalib.hpp 2021-09-28 21:21:08.000000000 +0200 @@ -98,7 +98,7 @@ glyph flip(bool x, bool y) const; void invert(); glyph upscale(const vfsize &factor) const; - void lge(); + void lge(unsigned int adj = 1); private: std::vector<uint32_t> as_rgba() const; @@ -110,6 +110,7 @@ class font { public: + font(); void init_256_blanks(); int load_bdf(const char *file); int load_clt(const char *dir); @@ -132,8 +133,10 @@ void upscale(const vfsize &factor) { for (auto &g : m_glyph) g = g.upscale(factor); } void lge(); + void lgeu(); + void lgeuf(); - std::string name = "vfontas output"; + std::map<std::string, std::string> props; private: std::pair<int, int> find_ascent_descent() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/smm/vfontas.cpp new/hxtools-20210928/smm/vfontas.cpp --- old/hxtools-20210803/smm/vfontas.cpp 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/smm/vfontas.cpp 2021-09-28 21:21:08.000000000 +0200 @@ -9,6 +9,7 @@ * For details, see the file named "LICENSE.GPL3". */ #include "config.h" +#include <algorithm> #include <memory> #include <string> #include <utility> @@ -130,6 +131,18 @@ return true; } +static bool vf_lgeu(font &f, char **args) +{ + f.lgeu(); + return true; +} + +static bool vf_lgeuf(font &f, char **args) +{ + f.lgeuf(); + return true; +} + static bool vf_loadbdf(font &f, char **args) { auto ret = f.load_bdf(args[0]); @@ -285,9 +298,29 @@ return false; } +static bool vf_setbold(font &f, char **args) +{ + f.props.insert_or_assign("TTFWeight", "700"); + f.props.insert_or_assign("StyleMap", "0x0020"); + f.props.insert_or_assign("Weight", "bold"); + return true; +} + static bool vf_setname(font &f, char **args) { - f.name = args[0]; + std::string ps_name = args[0]; + /* PostScript name does not allow spaces */ + std::replace(ps_name.begin(), ps_name.end(), ' ', '-'); + f.props.insert_or_assign("FontName", std::move(ps_name)); + f.props.insert_or_assign("FullName", args[0]); + f.props.insert_or_assign("FamilyName", args[0]); + f.props.emplace("Weight", "medium"); + return true; +} + +static bool vf_setprop(font &f, char **args) +{ + f.props.insert_or_assign(args[0], args[1]); return true; } @@ -432,6 +465,8 @@ {"flipv", 0, vf_flipv}, {"invert", 0, vf_invert}, {"lge", 0, vf_lge}, + {"lgeu", 0, vf_lgeu}, + {"lgeuf", 0, vf_lgeuf}, {"loadbdf", 1, vf_loadbdf}, {"loadclt", 1, vf_loadclt}, {"loadfnt", 1, vf_loadfnt}, @@ -449,7 +484,9 @@ {"savepbm", 1, vf_savepbm}, {"savepsf", 1, vf_savepsf}, {"savesfd", 1, vf_savesfd}, + {"setbold", 0, vf_setbold}, {"setname", 1, vf_setname}, + {"setprop", 2, vf_setprop}, {"upscale", 2, vf_upscale}, {"xcpi", 2, vf_xcpi}, {"xlat", 2, vf_xlat}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/suser/Makefile.am new/hxtools-20210928/suser/Makefile.am --- old/hxtools-20210803/suser/Makefile.am 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/suser/Makefile.am 2021-09-28 21:21:08.000000000 +0200 @@ -21,6 +21,7 @@ mailsplit \ rezip +declone_LDADD = ${libHX_LIBS} sysinfo_LDADD = ${libHX_LIBS} ${libmount_LIBS} ${libpci_LIBS} ${libxcb_LIBS} tailhex_LDADD = ${libHX_LIBS} xcp_LDADD = ${libHX_LIBS} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/suser/Makefile.in new/hxtools-20210928/suser/Makefile.in --- old/hxtools-20210803/suser/Makefile.in 2021-08-03 21:25:16.908554902 +0200 +++ new/hxtools-20210928/suser/Makefile.in 2021-09-28 21:21:34.762620656 +0200 @@ -107,10 +107,10 @@ PROGRAMS = $(bin_PROGRAMS) declone_SOURCES = declone.c declone_OBJECTS = declone.$(OBJEXT) -declone_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +declone_DEPENDENCIES = $(am__DEPENDENCIES_1) sysinfo_SOURCES = sysinfo.c sysinfo_OBJECTS = sysinfo.$(OBJEXT) -am__DEPENDENCIES_1 = sysinfo_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) tailhex_SOURCES = tailhex.c @@ -327,6 +327,7 @@ mailsplit \ rezip +declone_LDADD = ${libHX_LIBS} sysinfo_LDADD = ${libHX_LIBS} ${libmount_LIBS} ${libpci_LIBS} ${libxcb_LIBS} tailhex_LDADD = ${libHX_LIBS} xcp_LDADD = ${libHX_LIBS} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hxtools-20210803/suser/declone.c new/hxtools-20210928/suser/declone.c --- old/hxtools-20210803/suser/declone.c 2021-08-03 21:24:36.000000000 +0200 +++ new/hxtools-20210928/suser/declone.c 2021-09-28 21:21:08.000000000 +0200 @@ -1,66 +1,104 @@ /* - * declone.c - unlink but preserve a file - * written by Jan Engelhardt, 2004-2007 + * declone.c - break hardlink off a file + * written by Jan Engelhardt, 2021 * * This program is free software; you can redistribute it and/or * modify it under the terms of the WTF Public License version 2 or * (at your option) any later version. */ -#include <sys/stat.h> -#include <sys/types.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#define BLOCKSIZE 4096 +#include <libHX/defs.h> +#include <libHX/string.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/types.h> static void dofile(const char *file) { struct stat sb; - ssize_t ret; - char buffer[BLOCKSIZE]; - int in, out; - - if ((in = open(file, O_RDONLY)) < 0) { + int infd = open(file, O_RDONLY); + if (infd < 0) { fprintf(stderr, "Could not open %s: %s\n", file, strerror(errno)); return; } - if (fstat(in, &sb) < 0) { + if (fstat(infd, &sb) < 0) { fprintf(stderr, "Could not stat %s: %s\n", file, strerror(errno)); - return; + goto out; } - if (unlink(file) < 0) { - fprintf(stderr, "Could not unlink %s: %s\n", - file, strerror(errno)); - return; + void *inmap = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, infd, 0); + if (inmap == MAP_FAILED) { + fprintf(stderr, "mmap %s: %s\n", file, strerror(errno)); + goto out; + } + + char *cont_dir = HX_dirname(file); + if (cont_dir == NULL) { + fprintf(stderr, "%s\n", strerror(errno)); + goto out2; + } + hxmc_t *outname = HXmc_strinit(cont_dir); + if (outname == NULL) { + fprintf(stderr, "%s\n", strerror(errno)); + goto out3; } - if ((out = open(file, O_WRONLY | O_TRUNC | O_CREAT, - sb.st_mode)) < 0) { - fprintf(stderr, "Could not recreate/open file %s: %s\n", + if (HXmc_strcat(&outname, "/decloneXXXXXX") == NULL) { + fprintf(stderr, "%s\n", strerror(errno)); + goto out4; + } + if (mkstemp(outname) < 0) { + fprintf(stderr, "mkstemp: %s\n", strerror(errno)); + goto out4; + } + int outfd = open(outname, O_RDWR, S_IRUGO | S_IWUGO); + if (outfd < 0) { + fprintf(stderr, "open %s: %s\n", outname, strerror(errno)); + goto out4; + } + if (ftruncate(outfd, sb.st_size) < 0) { + fprintf(stderr, "ftruncate %s: %s\n", outname, strerror(errno)); + goto out5; + } + if (fchown(outfd, sb.st_uid, sb.st_gid) < 0 || + fchmod(outfd, sb.st_mode) < 0) { + fprintf(stderr, "fchown/fchmod %s: %s\n", outname, strerror(errno)); + goto out5; + } + void *outmap = mmap(NULL, sb.st_size, PROT_WRITE, MAP_SHARED, outfd, 0); + if (outmap == MAP_FAILED) { + fprintf(stderr, "mmap %s: %s\n", outname, strerror(errno)); + goto out5; + } + memcpy(outmap, inmap, sb.st_size); + if (msync(outmap, sb.st_size, MS_ASYNC) < 0) { + fprintf(stderr, "msync: %s\n", strerror(errno)); + goto out6; + } + if (rename(outname, file) < 0) { + fprintf(stderr, "Could not replace %s: %s\n", file, strerror(errno)); - fgets(buffer, 4, stdin); - return; + goto out6; } - printf("* %s\n", file); - fchown(out, sb.st_uid, sb.st_gid); - fchmod(out, sb.st_mode); - while ((ret = read(in, buffer, BLOCKSIZE)) > 0) - if (write(out, buffer, ret) < 0) { - fprintf(stderr, "Error during write to %s: " - "%s\n", file, strerror(errno)); - break; - } - - if (ret < 0) - fprintf(stderr, "Error during read on %s: %s\n", - file, strerror(errno)); - close(in); - close(out); + out6: + munmap(outmap, sb.st_size); + out5: + close(outfd); + unlink(outname); + out4: + HXmc_free(outname); + out3: + free(cont_dir); + out2: + munmap(inmap, sb.st_size); + out: + close(infd); } int main(int argc, const char **argv)