Menu

Greek symbols in xfig 3.2.9

2024-01-08
2024-01-15
  • Mark Alford

    Mark Alford - 2024-01-08

    When I select Symbol(Greek) and start typing, I just get Roman characters. Dingbats work fine though.
    Is this different from issue 159? I'm not sure if the current version has that patch in it.

     
  • tkl

    tkl - 2024-01-08

    This is probably the same issue as in [#159]. A version containing the patch is not released yet. You would have to build from the development sources.

     

    Related

    Tickets: #159

  • Mark Alford

    Mark Alford - 2024-01-09

    I built from the source at https://sourceforge.net/projects/mcj/files/latest/download but it still has the same problem with Greek symbols. I guess that's not the development source code then?

     
  • tkl

    tkl - 2024-01-09

    No, sorry, the development tree is found under the git tab, https://sourceforge.net/p/mcj/xfig/ci/master/tree/. There is a button on top promising "Download Snapshot". In addition to the usual build tools, libraries and header files, which you obviously have, autotools are necessary. Do autoreconf -i on the top level of the sources, after that ./configure in the same directory works.

     
  • Mark Alford

    Mark Alford - 2024-01-10

    OK, I did that. The resulting code still has the same issue with Greek symbols.
    Debugging output:

    Warning: Missing charsets in String to FontSet conversion
    button_font: 6x13, fid: 79691778
    roman_font: 6x13, fid: 79691777
    mono_font: Noto Sans Mono-8.33333:familylang=en:style=Regular:stylelang=en:fullname=Noto Sans Mono Regular:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=11.1111:foundry=GOOG:antialias=False,True:hintstyle=1:hinting=True:verticallayo
    Warning: Missing charsets in String to FontSet conversion
    initialize_input_method()...
    styles[0]=810
    styles[1]=408
    xfig: selected input style: None
    input method initialized
    xim_set_ic_geometry(881, 721)
    add_point - alloc 200 points
    Font request: symbol,StandardSymbolsPS,StandardSymbolsL
    result: Noto Sans Symbols-10:familylang=en:style=Regular:stylelang=en:fullname=Noto Sans Symbols Regular:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=13.3333:foundry=GOOG:antialias=True:hintstyle=1:hinting=True:verticallayout=False
    Font request: symbol,StandardSymbolsPS,StandardSymbolsL
    result: Noto Sans Symbols-150:familylang=en:style=Regular:stylelang=en:fullname=Noto Sans Symbols Regular:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=200:foundry=GOOG:antialias=True:hintstyle=1:hinting=True:verticallayout=False:au
    Font request: symbol,StandardSymbolsPS,StandardSymbolsL
    result: Noto Sans Symbols-150:familylang=en:style=Regular:stylelang=en:fullname=Noto Sans Symbols Regular:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=200:foundry=GOOG:antialias=True:hintstyle=1:hinting=True:verticallayout=False:au
    Font request: symbol,StandardSymbolsPS,StandardSymbolsL
    result: Noto Sans Symbols-150:familylang=en:style=Regular:stylelang=en:fullname=Noto Sans Symbols Regular:fullnamelang=en:slant=0:weight=80:width=100:pixelsize=200:foundry=GOOG:antialias=True:hintstyle=1:hinting=True:verticallayout=False:au

     
  • tkl

    tkl - 2024-01-10

    You even did debugging! Sorry for the copious output that is a remain from me trying to find my way to call the xft library. Finer-grained debugging is also on the to-do list.
    From the debug output I gather that Noto fonts are installed, but neither Symbol nor dingbats from the urw-fonts. Then, presumably, the else-loop in line 1014 in u_fonts.c is triggered and, in case of symbol, a remapping is incorrectly applied. In case URW Symbol and Dingbats (StandardSymbolsPS and D050000L) are installed (under debian these are contained in the fonts-urw-base35 package), I am not sure whether and how fontconfig could be persuaded to pick those fonts.
    Workarounds:

    1. Installation of URW-fonts, plus probably tuning of fontconfig,
    2. insert the line return NULL; above line 1012 in line u_fonts.c. I you were curious what happens, I would be grateful if you could intersperse fputs(stderr, "adobe charset: returning NULL\n"); and fprintf(stderr, "adobe charset: returning %s\n, pattern"); lines into the code, but beware to have sufficient braces.

    In any case, ticket [#159] can not be closed. The fix applied with commit [1e2d84] should be improved.

     

    Related

    Tickets: #159
    Commit: [1e2d84]

    • tkl

      tkl - 2024-01-11

      insert the line return NULL; above line 1012 in line u_fonts.c.

      No, that should be return map_symbols; for a quick check whether displaying symbol characters from Noto Sans Symbols would work. But in the meantime I installed Noto Symbol fonts and could not yet cure the issue.

       
  • Mark Alford

    Mark Alford - 2024-01-12

    When I insert return map_symbols; ALL fonts come out as Greek (except Greek which comes out blank).

    Here is that region of the code:

    map_f
    adobe_charset(XftFont *font)
    {
        map_f   map = NULL;
    
        /*
         * Hack: does this font has small a in its charset?
         * If not it is likly a Symbol or a Dingbats derivate.
         */
            return map_symbols;   /* Line that I added */
        if (XftCharExists(tool_d, font, 0x61))
            return NULL;
        else {
    
     
  • tkl

    tkl - 2024-01-12

    Good catch. Thanks for testing, I will have to prepare a better patch.

    Here is my understanding of the issue:

    1. The URW symbol font, providing greek symbols in the ascii code range, is not found.
    2. For symbol font, Noto Sans Symbols is chosen. That font, however, does not have the greek characters expected in the code range 0x391 to 0x3c9. (Noto Sans Symbols does not provide any letterlike glyphs but symbols, e.g., "Miscellaneous Technical" (0x23??), "Miscellaneous Symbols" (0x26??), "Dingbats" (0x27??) and probably emoticons and other symbols.)
    3. For other fonts Noto Sans or Noto Serif are chosen by fontconfig. These fonts provide the greek characters in roughly 0x3??.

    Thus, another workaround to display greek symbols on the canvas would be, after removing the modification above, to use any font other than symbol or dingbats and insert the correct unicode code points. This could by done by copying them from another application, for instance a character map viewer and pasting using the Edit -> Paste Text menu item in xfig while creating a text object.

    Exporting to eps, ps, pdf or any bitmap format is another issue. For export to pdf and bitmaps, fig2dev calls ghostscript, which may have different ideas regarding its default fonts. Another way to pdf is by exporting to latex+pict2e or latex+tikz and using xelatex: fig2dev -L tikz -P greek.fig greek.tex && xelatex greek.tex. The latter should produce a pdf looking quite the same as the canvas.

     
  • Mark Alford

    Mark Alford - 2024-01-12

    OK yes that works. I can select Greek characters from a page like
    https://symbl.cc/en/collections/greek-symbols/
    and paste them in as you described. As you said, xfig can't export them, but if I export as Scalable Vector Graphics, then I can open the resulting svg file with Inkscape and export to PDF from there. That seems to work as a workaround.

    Based on your understanding of the issue, do you think you'll be able to fix it at some point?

     
    • tkl

      tkl - 2024-01-15

      Based on your understanding of the issue, do you think you'll be able to fix it at some point?

      Yes, a commit will probably take until next week. The next version of xfig and fig2dev containing a fix will probably be released within a few weeks.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.