Hi,

I was a little surprised to see that the spaces for most monospace fonts
are not respected when using \xmlflushspacewise (see code below):

https://i.ibb.co/C5LPVKsH/monospace-table.png

Using \xmlverbatim displays as expected. For  my actual document, I cannot
use \xmlprettyprint because it generates an error.

Is \xmlflushspacewise supposed to honour the glyph metrics of the space
character for monospace fonts?

mtx-context     | current version: 2025.08.21 23:32

% ---- 8< ----
\startbuffer[test]
<?xml version="1.0"?>
<document><pre>
|aaa|bbb|ccc|
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
</pre></document>
\stopbuffer

\startxmlsetups xml:setup
  \xmlsetsetup{\xmldocument}{*}{-}
  \xmlsetsetup{\xmldocument}{document|pre}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:setup}

\startxmlsetups xml:document
  \startdocument \xmlflush{#1} \stopdocument
\stopxmlsetups

\define[2]\Verbatim{
  \startxmldisplayverbatim
    \setupbodyfont[#1]
    \xmlflushspacewise{#2}
  \stopxmldisplayverbatim
}

\startxmlsetups xml:pre
  \Verbatim{TextFontIN}{#1}
  \Verbatim{TextFontRM}{#1}
  \Verbatim{TextFontSP}{#1}
  \Verbatim{TextFontFC}{#1}
  \Verbatim{TextFontLM}{#1}
\stopxmlsetups

\definefontfamily [TextFontSP] [tt] [Source Code Pro]
\definefontfamily [TextFontRM] [tt] [Roboto Mono]
\definefontfamily [TextFontIN] [tt] [Inconsolata]
\definefontfamily [TextFontFC] [tt] [Fira Code]
\definefontfamily [TextFontLM] [tt] [Luxi Mono]

\usetypescript[TextFont]

\xmlprocessbuffer{main}{test}{}
% ---- 8< ----

Aside, should this code be returning an error?

mtx-context     | fatal error: return code: 1

Thank you!
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to