Update of bug #67207 (group groff):

                  Status:               Need Info => In Progress
             Assigned to:                    deri => gbranden

    _______________________________________________________

Follow-up Comment #4:

Thanks for the feedback, Deri.  I _think_ I know what I need to proceed.

Landing `SS` support for _gropdf_ is proving to be quite the tangle.

Here's a forward-chronological log of relevant commits in my working tree.

At the top of this I'll be inserting a change to address bug #59284.

I'll also attach a "diffy" version of this log, showing the code changes.


commit 5f75a971a667465719cd5f94fe6c6f0e9f7c96bb
Author: G. Branden Robinson <[email protected]>
Date:   Sat Jun 14 18:13:24 2025 -0500

    [grohtml]: Disclose more info in fatal diagnostic.
    
    * src/devices/grohtml/post-html.cpp (html_printer::set_style): Disclose
      name of font description file lacking `internalname` directive in
      fatal diagnostic when this is the case.

commit 820790f7f8b41972b6e376c8f6ef4b6dce71023a
Author: G. Branden Robinson <[email protected]>
Date:   Sun Jun 8 12:42:57 2025 -0500

    font/devpdf/devpdf.am: Refactor.
    
    This change also ships font description file names for the "pdf" output
    device corresponding to the 8 new font description files for CJK script
    support recently added for the "{x,}html", "ps", and "utf8" devices.
    
    These are intended as abstractions of faces to permit consistent naming
    while permitting customization, just as with the 12 text typefaces
    supported across output devices for Latin scripts in groff (three
    families of four styles each).  These CJK font descriptions are not
    organized into groff font families, but are similar.  They are not
    mounted by default.
    
            CSH: Simplified Chinese, Hei style
            CSS: Simplified Chinese, Song style
            CTH: Traditional Chinese, Hei style
            CTS: Traditional Chinese, Song style
            JPG: Japanese, Gothic style
            JPM: Japanese, Mincho style
            KOG: Korean, Gothic style
            KOM: Korean, Mincho style
    
    * font/devpdf/devpdf.am: Make this script more Automake-idiomatic (I
      think) and resemble other groff Automake scripts more closely.
    
      (devpdf_builddir): Define macro.
    
      (GROFF_FONT_FILES, ENC_FILES, MAP_FILES): Drop macros populated by
      shell command substitution in favor of static file lists...
    
      (DEVPDFFONTFILES_FROM_DEVPS): ...like this...
    
      (DEVPDFFONTFILES_FOR_URW) [HAVE_URW_FONTS]: ...and this.
    
      (DEVPDFFONTFILES): New macro contains only
      `DEVPDFFONTFILES_FROM_DEVPS` plus the "download" and "DESC" files.
    
      (devpdffontdata, devpdffontencdata): Rationalize contents, aligning
      files and macro contents with installation requirements so Automake
      takes care of installing and uninstalling them.
    
      (MOSTLYCLEANFILES): Add `devpdffontdata`, `devpdffontencdir`,
      `devpdffontmapdir`, so that Automake takes care of cleaning them.
    
      ($(DEVPDFFONTFILES_FROM_DEVPS)): New target copies "ps" device's font
      descriptions to build's "pdf" device data directory.
    
      ($(devpdffontencdata)): Now that the "text.enc" encoding file name is
      stored in a macro, use it and compute its basename instead of using
      literals.
    
      ($(DEVPDFFONTFILES_FOR_URW)): Make the "pdf" device's "download" file
      depend on this macro's contents, which may be empty if
      `HAVE_URW_FONTS` is not defined by the "configure" script.
    
      (font/devpdf/stamp): Respell dependencies using above macros.
    
      (mostlyclean-local, mostlyclean_devpdf_extra)
      (install-data-local, install_devpdf)
      (uninstall_groffdirs, uninstall_devpdf): Drop targets made redundant
      by better population of `devpdf*data` macros above.

commit 9bad0c0b2a62e3245d1ab7b18f59e27dc546e374
Author: G. Branden Robinson <[email protected]>
Date:   Tue Jun 10 06:49:24 2025 -0500

    gropdf(1): Document East Asian typeface support.
    
    * src/devices/gropdf/gropdf.1.man (Usage): Do it.
    
    * src/devices/grohtml/grohtml.1.man (Typefaces):
    * src/devices/grops/grops.1.man (Typefaces):
    * src/devices/grotty/grotty.1.man (Typefaces): Add gropdf(1) to the list
      of output drivers supporting this scheme.
    
    See https://savannah.gnu.org/bugs/?62830 for background.  As Deri noted
    there, gropdf "already handles CJK documents".  The change here is to
    improve document portability across groff output drivers by permitting
    an author to abstract away (or be indifferent to) the exact face
    providing CJK glyph coverage, in much the same way that an author using
    a language in the Latin script can restrict the document's explicit
    typeface usage to "R", "I", "B", and "BI".

commit 96960aa9639d74417eb07b1b4589a50123d92053
Author: G. Branden Robinson <[email protected]>
Date:   Fri Jun 13 17:39:21 2025 -0500

    [devpdf]: Fix `BuildFoundries.pl` warning text.
    
    * font/devpdf/util/BuildFoundries.pl (UseGropsVersion): Interpolate
      correct variable name in warning diagnostic.

commit 510c9fad16d44c9e989f97cbe3948843ca6c07a3
Author: G. Branden Robinson <[email protected]>
Date:   Sat Jun 14 08:44:09 2025 -0500

    [devpdf]: Stop BuildFoundries.pl from clobbering.
    
    * font/devpdf/util/BuildFoundries.pl (UseGropsVersion): Don't overwrite
      a font description file if it already exists.  Revise emitted warning
      diagnostic when one of the (now) multiple conditions preventing its
      writing fails.

commit c903bca0e8a91a74f25e049a90012d082cd0be31
Author: G. Branden Robinson <[email protected]>
Date:   Fri Jun 13 19:32:18 2025 -0500

    [devpdf]: Fix dupe `close()` in BuildFoundries.pl.
    
    * font/devpdf/util/BuildFoundries.pl (UseGropsVersion): Drop redundant
      `close()` of `GF` file handle.
    
      (RunAfmtodit, UseGropsVersion): Also move non-duplicate `close()`
      calls to occur much earlier, as soon as we're done reading from a file
      handle, to reduce risk of late/duplicate placement being restored.

commit 31bf70c4adf21302adc7070762b52fe4e077cb9b
Author: G. Branden Robinson <[email protected]>
Date:   Fri Jun 13 18:56:00 2025 -0500

    [devpdf]: Die more when BuildFoundries.pl strict.
    
    * font/devpdf/util/BuildFoundries.pl: Make more scenarios fatal when
      `--strict` command-line option specified.  Clarify the applicable
      diagnostic messages.
    
      (RunAfmtodit, UseGropsVersion): When being strict, if a font
      description file doesn't have exactly 1 `internalname` directive, die
      instead of warning.
    
      (UseGropsVersion, LoadFoundry): When being strict, if a font
      description file (for gropdf) can't be created, die instead of
      warning.

commit a0452f28544c17cdf838e59b6ee7e24823e407ac
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 15:14:55 2025 -0500

    [devpdf]: Trivially refactor "BuildFoundries.pl".
    
    * font/devpdf/util/BuildFoundries.pl: Rename scalars for clarity.
      Rename global `where` scalar to `destDir`.  Rename global scalar `lct`
      to `lineNumber`, since it is used only in diagnostic messages to make
      reports about validity problems in a file being read.
    
      (LoadFoundry, LoadDownload, CheckFoundry): Rename local scalar `fn` to
      `fileName`.
    
      (Notice, Warn, Die, Msg): Rename local scalar `msg` to `message` so
      that we don't have two identifiers that differ only in lettercase.

commit e356854dd17f7ebebb77f61a1865d938864f9614
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 15:18:40 2025 -0500

    [devpdf]: Refactor diags in "BuildFoundries.pl".
    
    * font/devpdf/util/BuildFoundries.pl: Refactor diagnostic production.
      Demote scalar `lineNumber` from global scope...
      (LoadFoundry): ...to a local one, here.
    
      (FileWarn): New subroutine reports diagnostics relevant to parsing of
      an input file in GNU standard format.
    
      (LoadFoundry): Migrate file-applicable diagnostic message from `Warn`
      to `FileWarn`.
    
      (Warn): Drop report of line number, so that we won't report an
      irrelevant one (with no corresponding file name!) when diagnosing
      problems unrelated to input file parsing.
    
    See <https://www.gnu.org/prep/standards/standards.html#Errors>.

commit 0aaac0004d53090c03fbf7c29faa268aa0ecf77c
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 15:45:53 2025 -0500

    [devpdf]: Recast diags in "BuildFoundries.pl".
    
    * font/devpdf/util/BuildFoundries.pl: Recast diagnostic messages.
    
      (LoadFoundry, RunAfmtodit): Say simply "font description file",
      dropping "groff"; (1) this file format is used by other
      device-independent troffs and (2) now that we say "font _description_
      file", it's adequately distinguished from the term "font file",
      applicable to e.g., PFA, OTF, or TTF files.
    
      (LoadFoundry, CheckFoundry): Generalize fatal diagnostic upon Perl
      `open` failure to say simply "cannot open" (when reading) and "cannot
      create" (when writing) and report Perl's error message using `$!`.
    
      (LoadFoundry, RunAfmtodit, UseGropsVersion): Spell "foundry"
      thus--uncapitalized--in diagnostic messages that refer to a specific
      foundry name (such as "U" for "URW"), rather than to the "Foundry"
      file this program reads as input.

commit 6c3fddb55599ddccf16e1eb7372d7cccb54ced95
Author: G. Branden Robinson <[email protected]>
Date:   Sat Jun 14 10:05:39 2025 -0500

    [devpdf]: Refactor "BuildFoundries.pl" (1/3).
    
    * font/devpdf/util/BuildFoundries.pl (UseGropsVersion): Refactor for
      clarity.  Add new local scalar `doWrite` to control whether we attempt
      to write a (grops-based) font description file for gropdf(1).
      Restructure conditionals accordingly, and drop recently added
      diagnostic warning (when being "strict") that we're not attempting to
      perform the rewrite of an existing file.

commit a91bbd5a642eaf7d49fbc720686bc7d49699991d
Author: G. Branden Robinson <[email protected]>
Date:   Fri Jun 13 08:00:36 2025 -0500

    [devpdf]: Refactor "BuildFoundries.pl" (2/3).
    
    * font/devpdf/util/BuildFoundries.pl: Refactor.
    
      (RunAfmtodit, UseGropsVersion): Pull duplicated logic to open a groff
      font description file, extract the argument to its `internalname`
      directive if there is one, emit a diagnostic if there is none or more
      than one, and return that argument as a PostScript font name out of
      here...
      (GetPostScriptFontName): ...into here.
    
      (UseGropsVersion): However, since there was one difference, retain
      here the logic to re-read the lines of the groff font description file
      into an array so they can be rewritten into gropdf(1)'s copy thereof.
      Rename file handle `GF` to `PDFGF` when writing, so that we don't use
      the same name to read one file name and write another.
    
    This does mean a duplicative file open and read, but "BuildFoundries" is
    seldom run, and never by anything in groff except its Makefiles.  (On
    the other hand, Deri is contemplating plans that might change this...see
    comment #15 to <https://savannah.gnu.org/bugs/?65098>.)  Should those
    eventuate, we might have `GetPostScriptFontName()` return a list.

commit cc5b7de7b9783788745b9b4bd9538886a62ee03c
Author: G. Branden Robinson <[email protected]>
Date:   Fri Jun 13 15:31:12 2025 -0500

    [devpdf]: Refactor "BuildFoundries.pl" (3/3).
    
    * font/devpdf/util/BuildFoundries.pl: Refactor.
    
      (DescribeFoundry): New subroutine turns a `$foundry` identifier into a
      human-readable description.  The default foundry is an empty string,
      which can look confusing and/or unintended in diagnostic messages,
      distracting the user from real problems.
    
      (GetPostScriptFontName, UseGropsVersion): Use it.

commit 7bb52b828f58a3fa7e2ebe11ead8f5cb19554125
Author: G. Branden Robinson <[email protected]>
Date:   Mon Jun 9 13:18:47 2025 -0500

    font/devutf8/devutf8.am: Tweak generated "DESC".
    
    * font/devutf8/devutf8.am (DEVUTF8FONTS): Tweak ordering of mounted CJK
      faces in "DESC" file generated for "utf8" output device.  Consistently
      arrange the Hei (~serif) faces before the Song (~sans-serif) ones.

commit c0055923afc69cb5518978398af1422d7717e0e5
Author: G. Branden Robinson <[email protected]>
Date:   Mon Jun 9 13:51:29 2025 -0500

    font/devpdf/devpdf.am: Fix up "download" file gen.
    
    * font/devpdf/devpdf.am (font/devpdf/download): Explicitly remove the
      target before (re)constructing it because if we don't, BuildFoundries
      will opportunistically open it and modify it in place, leading to the
      banner created with `echo` being uselessly repeated.  (Potentially, it
      could retain stale data in other respects.)

commit 118df3b24bceec3aececc12578db92b2ec3a2d01
Author: G. Branden Robinson <[email protected]>
Date:   Sat Jun 14 10:36:50 2025 -0500

    [gropdf]: Trivially refactor.
    
    * src/devices/gropdf/gropdf.pl (do_x): Trivially refactor.  Rename
      scalar `FDnm` to `fileName`.

commit 1014a26181675dfe3c2e2f879a00b3bbbfb3b70b
Author: G. Branden Robinson <[email protected]>
Date:   Sat Jun 14 10:46:33 2025 -0500

    [gropdf]: Refactor.
    
    * src/devices/gropdf/gropdf.pl (OpenInc): Rename this subroutine...
      (OpenInclusionFile): ...to this.  Also rename local scalars for
      clarity, and give them clearer semantics.  `fn` becomes `arg`, and is
      the untransformed actual parameter passed in.  Rename `fnm` to
      `fileName`, which is used only when the subroutine performs a
      transformation on `arg` (when it is not an absolute filespec, the code
      tries to locate it by prefixing with elements of the `idirs` list).
    
      (do_x): Update call site.

commit c2bc47240e6ada2b77180ab6bc57a7f91729f338
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 16:52:32 2025 -0500

    [gropdf]: Use stricter DOS/Windows filespec check.
    
    * src/devices/gropdf/gropdf.pl (OpenFile, OpenInclusionFile): Make check
      MS-DOS/Windows-style absolute filespec stricter; not only must the
      second character be ':', but the first must be an uppercase Basic
      Latin letter.

commit f3f31d4a30362b0d7e98aec36da84c035a8992b6
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 18:33:03 2025 -0500

    [gropdf]: Refactor `OpenFile()`.
    
    * src/devices/gropdf/gropdf.pl (OpenFile): Refactor to more closely
      resemble `OpenInclusionFile()`, since they are quite similar in
      purpose.  Instead of modifying arguments, return a 2-list containing a
      file handle (or undef), and the name of the file argument as resolved
      to its actual location when sought {which is unchanged if absolute}.
      Copy stricter MS-DOS/ Windows-style absolute filespec check from
      `OpenInclusionFile()`.
    
      (LoadDownload, LoadDesc, LoadFont, GetType1): Update call sites to new
      calling convention.

commit 76133cbf52398bfa2712321fb8c418cddaa59477
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 18:55:38 2025 -0500

    [gropdf]: Slightly refactor `OpenInclusionFile()`.
    
    * src/devices/gropdf/gropdf.pl (OpenInclusionFile): Refactor to make
      subroutine single-return.

commit 43a9a6002db64ce5c03b7b354df920c545823e41
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 09:59:52 2025 -0500

    [gropdf]: Warn on invalid "download" file entries.
    
    * src/devices/gropdf/gropdf.pl: Throw warning diagnostics when
      encountering invalid "download" file entries.
    
      (ParseWarn): New subroutine throws warning diagnostic with file
      name and line number information.
    
      (LoadDownload): Use it.

commit 8dfe92063e0cbbd299a576480418129ad8e07ed6
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 15:03:34 2025 -0500

    [gropdf]: Report all attempted "download" files.
    
    ...if none could be opened.
    
    * src/devices/gropdf/gropdf.pl: Report locations of all "download" files
      attempted for reading if problems were encountered with any of them.
      Add `attemptedDownloadFiles` list and `foundAnyDownloadFiles` scalar
      (Boolean-valued).  Prior to exiting, test `foundAnyDownloadFiles` for
      falsity, and emit the report as a fatal diagnostic.
    
      (LoadDownload): Drop `found` scalar and fatal diagnostic emitted if
      none are found; instead populate and update the new globals with each
      unsuccessful `open()` of a "download" file.

commit 357bd3b74b0b4a402ccaea5598bd4805fc272d7a
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 15:08:38 2025 -0500

    [gropdf]: Slightly refactor `LoadDownload()`.
    
    * src/devices/gropdf/gropdf.pl (LoadDownload): Rename local scalars for
      clarity.
        `f`      -> `df` (a file handle)
        `lineno` -> `lineNumber`
        `file`   -> `fontFile`
      Also populate `downloadFile` using `OpenFile()`'s new more helpful
      return type.

commit cae4215279c569d3a2a2b02dbcfabbe0a67bca35
Author: G. Branden Robinson <[email protected]>
Date:   Thu Jun 12 14:27:10 2025 -0500

    [gropdf]: Improve font embedding failure diags.
    
    * src/devices/gropdf/gropdf.pl:  Add global list `nonEmbeddedFonts` to
      accommodate legacy feature of "standard" fonts that don't get embedded
      (and which is still gropdf's default behavior).  Add global scalar
      `hadAnyEmbeddingProblems` (Boolean-valued).  Prior to exiting, test
      `hadAnyEmbeddingProblems` for truth, and emit a report of attempted
      "download" files.
    
      (LoadDownload): If not embedding all fonts and we just encountered one
      marked with a `*` prefix indicating its "standard" status, push its
      key onto the `nonEmbeddedFonts` list.
    
      (LoadFont): Reorganize embedding failure logic to base failure on the
      absence of a font key from the `nonEmbeddedFonts` list instead of the
      key's presence in the `missing` hash.  Upon failure to embed a font,
      make `hadAnyEmbeddingProblems` true.  Recast warning diagnostics to
      use groff-idiomatic phrasing.

commit be08a01c220c2dbc13e3941fdcf490493fa6bc6a
Author: Deri James <[email protected]>
Date:   Mon Jul 3 15:44:29 2023 +0100

    [devpdf,gropdf]: Add `SS` font support (1/2).
    
    Replace pseudo-slanted characters with a real font, improving typography
    of, e.g., slanted lowercase Greek letters as used in eqn(1).
    
    * font/devpdf/StandardSymSL.pfb:
    * font/devpdf/SS: Add new files.
    
    * font/devpdf/DESC.in: Mount `SS` font at position 6.
    
    * tmac/pdf.tmac: Drop `pdf:SS` macro defining fallback character with a
      slant of 16 degrees for the argument, and 28 calls of it for 24
      lowercase Greek letters and 4 variant forms.
    
    Fixes <https://savannah.gnu.org/bugs/?65098> (1/2).

commit 5c8d684ef82adcc1454dededd5f8dcb461683b56
Author: G. Branden Robinson <[email protected]>
Date:   Tue Jun 10 08:35:28 2025 -0500

    [devpdf]: Add `SS` font support (2/2).
    
    Ship "StandardSymSL.pfb" embeddable font file and "SS" font description
    file for it.
    
    * font/devpdf/devpdf.am (DEVPDFFONTFILES_FROM_DEVPS): Add `SS`.
      (font/devpdf/download): Use sed(1) to interpolate an entry for
      "Symbol-Slanted" into the "download" file.
    
      (install-data-local, install_devpdf, uninstall-local)
      (uninstall_devpdf): Hook into Automake {,un}installation targets to
      cope with heretofore latent bug: gropdf doesn't know how about build
      trees that differ from source trees.  (In fact, it doesn't know about
      environments that aren't installations at all, which is mostly a good
      thing.)  Unfortunately this limitation prevents the
      "StandardSymSL.pfb" file from being embedded in "groff-man-pages.pdf",
      where we'd like to use it for the eqn(1) man page.  As the comment
      notes, if we generate "StandardSymSL.pfb" from source, we can add a
      make(1) rule for it, put its name in the `devpdffontdata` macro, and
      not have to mess with it in these {,un}install hooks at all.  (We
      might want to retain the uninstall hook to remove the `devpdffontdir`
      directory.)
    
    Fixes <https://savannah.gnu.org/bugs/?65098> (2/2).


(file #57293)

    _______________________________________________________

Additional Item Attachment:

File name: for-67207.diff                 Size: 91KiB
    <https://file.savannah.gnu.org/file/for-67207.diff?file_id=57293>


    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-e283fc1e831e1a9d7ef799b94eb90b95407712b3.tar.gz


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67207>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to