Change default font

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

The default font is "Roman". I want to change that to something else
like "Linux Libertine".

Before investing major time in figuring out how to do this I want to
know if there is a simple way to do this without diving into learning
[how to edit style
files](http://www.texmacs.org/tmweb/manual/webman-style.en.html). I
understand that once I learn how to edit style files I will be able to
do many more things in TeXmacs, but honestly, I just want to save
repetitive clicking each time I create a new document to set the font
to one I prefer.

TeXmacs 1.99.14.

baltakatei.com
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEOPlkN8g6yI4ot6lSV9pX2VF+b4YFAl+5fZgACgkQV9pX2VF+
b4YFIg//YrqbA7K6K+8rt0epocsWJbgviB0al4D2rfe+COPS2DD7IARY95zzseet
4bs49J4O6e9qtbT5xJApDlLOwLjO1+UK4sDlNnJGuxTmTUGxWZCRu0FoLWkVX/Wk
9Dw1pgMpbmheHrFZBVcvPVBrOdEcznZRI/zOIRXXMgFJfaBIMsuTja1TqpDeW9Uo
H0WUPs7EQuQxN1mVnLRtGN/TsJKk8ooV9ZVYe4x0ESzlSFD7od2nm5z8ZdF33ezn
O3aHZjDQ1wHP8C+S9r3FvmXSZ2K2kwBIsX4+tYT5bLiAuCUJYCEozWeHngTue7qh
m/jzLHHneQT+UOZvvw199MWEe7vx0YG69lsUO0L/FMSRT3VgD5JRpGhhYjFxSp/b
En3Wr28+ms7wCwPrXbYr1TQ18XwVT9UwTfh1hRkFAq0BMmSltTDVx75FV+iDvPC4
dRM7MsT51/IRA0TrSQZRJO5IEqVorU+9AgCA2YhXK64Mg8J+pn3YWMBIrauYaokA
qhed1IgBcyQbBhz39teh2BijZZHfmB9sUkLVwdmqFIRVQg+es12E4+zEOFatJFrt
uYqhayGY8OiyZ+76jxZF6zQTfJqS7a5+55A/eiag7Bhc0uPf3Vi43ZJHjhsTQG1T
6kW/FPYp/7KOf0rm/ZPxMxMfLo7gh91Wtdm6yC0gQhyKuNnaTCI=
=/ebP
-----END PGP SIGNATURE-----

I imagine that this is hardcoded in some of the standard style files. So just find it, redefine that style file and put your copy in .TeXmacs/styles (or something like this, see the docs).

I investigated a bit. Using grep you can find all the occurrences of the string ‘roman’ in the source code, e.g.

mgubi@Ulrike svn-src % grep -r "\"roman\"" src                
src/Style/Evaluate/evaluate_textual.cpp:  if (s2 == "roman")  return roman_nr  (nr);
src/Texmacs/Window/tm_button.cpp:  string family  = "roman";
src/Typeset/Env/env_exec.cpp:  if (s2 == "roman") return roman_nr (nr);
src/Typeset/Env/env_default.cpp:  env (FONT)             = "roman";     // the font name in text mode
src/Typeset/Env/env_default.cpp:  env (MATH_FONT)        = "roman";     // the font name in math mode
src/Typeset/Env/env_default.cpp:  env (PROG_FONT)        = "roman";     // the font name in prog mode
src/Graphics/Fonts/font.cpp:  return "roman";
src/Graphics/Fonts/font.cpp:  return "roman";  
src/Graphics/Fonts/font.cpp:  return "roman";
src/Graphics/Fonts/smart_font.cpp:    f == "roman" ||
src/Graphics/Fonts/smart_font.cpp:    if (fam == "roman" && get_unicode_range (c) == "greek") {
src/Graphics/Fonts/smart_font.cpp:    if (fam == "roman" && N(c) > 1) {
src/Graphics/Fonts/smart_font.cpp:  if (mfam == "roman" && shape == "mathupright" && variant == "rm" &&
src/Graphics/Fonts/smart_font.cpp:    int nvdpi= adjusted_dpi ("roman", variant, series, "mathitalic", 1);
src/Graphics/Fonts/smart_font.cpp:    fn[nr]= smart_font_bis ("roman", variant, series, "mathitalic", sz,
src/Graphics/Fonts/smart_font.cpp:  font sec_fn= closest_font ("roman", "ss", "medium", "right", sz, vdpi);
src/Graphics/Fonts/smart_font.cpp:  if (tfam == "roman") tfam= family;
src/Graphics/Fonts/font_translate.cpp:  if (N(v) == 0) return "roman";
src/Graphics/Fonts/font_translate.cpp:    t ("modern")= "roman";
src/Graphics/Fonts/font_translate.cpp:    t ("cyrillic")= "roman";
src/Graphics/Fonts/font_translate.cpp:    t ("sys-chinese")= "roman";
src/Graphics/Fonts/font_translate.cpp:    t ("sys-japanese")= "roman";
src/Graphics/Fonts/font_translate.cpp:    t ("sys-korean")= "roman";
src/Data/Convert/Tex/fromtex.cpp:  if (!is_atomic (t)) return "roman";
src/Data/Convert/Tex/fromtex.cpp:  return "roman";
src/Data/Convert/Tex/fromtex.cpp:    return tree (NUMBER, tree(APPLY, u->label*"-nr"), "roman");

here you see that the relevant entry could be that in env_default.cpp which sets the default typesetting environment. One possibility is to change it in scheme every time the buffer is opened, see the Help->Manual->Customizing TeXmacs and in particular the section ‘Writing your own initialization files’. For example you can create a style file with your own customizations and then add the following code in $TEXMACS_HOME_PATH/progs/my-init-buffer.scm:

(when (buffer-newly-created? (current-buffer))
  (set-style-list (append (get-style-list) '("CustomStyle")))
  (buffer-pretend-saved (current-buffer)))

HTH.

1 Like