Re: [Tuxpaint-devel] UI font configuration
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
From: Bill K. <nb...@so...> - 2023-06-04 10:39:44
|
On Sun, Jun 04, 2023 at 09:02:33AM +0900, Shin-ichi TOYAMA wrote: > Hi! > > On Sat, 3 Jun 2023 13:49:34 -0700, Bill Kendrick wrote: > >So please `git pull` the master branch of the "tuxpaint" > >repo and rebuild. If it still doesn't work, let me know, > >and I'll blame it on another late-night coding session. ;) > > > >Tux Paint Config. does NOT use the same "parse" code, so > >it will now trim quotes IF it finds them at the beginning > >and end of the "uifont=" setting, but ALSO always ADD THEM. > > Tux Paint Config adds quotes around the fontname and > Tux Paint seems to consider those quotes as parts of the font > name, then fall back to the default font. Hrm, this is not happening for me. My config, for example: # Generated by tuxpaint-config version 0.0.22 uifont="DejaVu Sans" When I run Tux Paint: kendrick@gambit:~/tuxpaint/tuxpaint$ tuxpaint --nosound Requested UI font described by "DejaVu Sans" Actual UI font will be "DejaVu Sans" The quotes seen in the output above are from the format string, not the actual value of the string, e.g.: printf/*DEBUG_PRINTF*/("Requested UI font described by \"%s\"\n", tp_ui_font); Compare to my config file if I remove the quotes: # Generated by tuxpaint-config version 0.0.22 uifont=DejaVu Sans ...and then run Tux Paint: kendrick@gambit:~/tuxpaint/tuxpaint$ tuxpaint Requested UI font described by "DejaVu" Actual UI font will be "Noto Sans" The "Sans" part of "DejaVu Sans" is missing, so Pango ends up using a different font. What's happening on my system is when we use wordexp() to expand the argument, it seems to be splitting things on spaces. From the manpage: Field splitting is done using the environment variable $IFS. If it is not set, the field separators are space, tab and newline. If I add this line before the wordexp() call (in parse_file_options()) and then again after... printf("arg = <%s>\n", arg); ...I see this in tuxpaint's output: arg = <DejaVu Sans> arg = <DejaVu> Requested UI font described by "DejaVu" Actual UI font will be "Noto Sans" > I removed the quotes manually from tuxpaint.cfg file, then > it worked. Can you show me the output? Can you show me what 'arg' is before and after wordexp() is called? Thanks! -bill! > I think not adding quotes to the fontname in cfg file may > solve this. > > --- a/src/tuxpaint-config2.cxx > +++ b/src/tuxpaint-config2.cxx > @@ -782,7 +782,7 @@ void save_conf(void) > fprintf(fd, "alllocalefonts=yes\n"); > > if ((TEXTINP_uifont_isdef()) == 0) > - fprintf(fd, "uifont=\"%s\"\n", BROWSER_uifont->text(BROWSER_uifont->value())); > + fprintf(fd, "uifont=%s\n", BROWSER_uifont->text(BROWSER_uifont->value())); > > /* Printing: */ > /* --------- */ > > > However, it is not consistent with the fact that some other > options needs quotes like printcommand for those who edit cfg > file manually. > > Hrm... > > -- > Shin-ichi TOYAMA <dol...@wm...> -- -bill! Sent from my computer |