abougouffa / minemacs

MinEmacs: an Emacs configuration framework for daily use
https://abougouffa.github.io/minemacs/
MIT License
143 stars 16 forks source link

abot font set #50

Closed donneyluck closed 1 year ago

donneyluck commented 1 year ago
  minemacs-fonts
  '(:font-family "Noto Sans CJK SC"
    :font-size 13
    :variable-pitch-font-family "IBM Plex Serif"
    :variable-pitch-font-size 13))

i have set minemacs-font to Noto Sans CJK SC but when input chinese not use this font image

the font Noto Sans CJK SC is monospaced font

abougouffa commented 1 year ago

You can set the unicode font to Noto Sans CJK SC using:

(setq
  minemacs-fonts
  '(:font-family "Noto Sans CJK SC"
    :font-size 13
    :unicode-font-family "Noto Sans CJK SC" ;; <-- add this
    :variable-pitch-font-family "IBM Plex Serif"
    :variable-pitch-font-size 13))

This should solve your issue. However, it will use this font for all other supported Unicode glyphs.

You can set the default font only for CJK glyphs by tweaking unicode-fonts configuration to use the Noto Sans CJK SC. However, I don't know how and what font sections you should set. Take a look at the unicode-fonts repo for more info. See unicode-fonts-block-font-mapping.

donneyluck commented 1 year ago

https://github.com/abougouffa/minemacs/blob/main/elisp/%2Bminemacs.el#L82

http://xahlee.info/emacs/emacs/emacs_list_and_set_font.html

Maybe you can refer to xahlee's font setting method

Can be set separately

Font for Unicode Symbols Font for emoji Font for Chinese

https://protesilaos.com/emacs/fontaine here is a package about font

Fontaine lets the user specify presets of font configurations and set them on demand on graphical Emacs frames. The user option fontaine-presets holds all such presets.

The above are just some suggestions to make the font configuration in your frame more clear and simple thks for your time

abougouffa commented 1 year ago

Can be set separately

Font for Unicode Symbols Font for emoji Font for Chinese

My previous comment talks about this. In my config, I use unicode-fonts. This package defines a set of fonts to use for the different Unicode blocks (Emoji, Arabic, Hebrew, CJK, ...).

Even if you manage to set the fonts separately outside, unicode-fonts will override them. Unless you customize the unicode-fonts-block-font-mapping.

For me, I don't use other languages in my Emacs config, so I'm not interested to implement complex font configuration that I never use!

EDIT: In all cases, you can use a different font setting in your config file (based on fontaine or other package). If you like to ensure that your custom font settings doesn't gets overridden by MinEmacs' +set-font, you can hook your custom font config function to minemacs-after-set-fonts-hook.

donneyluck commented 1 year ago

ok thanks again

abougouffa commented 1 year ago

@donneyluck Take a look on my comment edit! It might be useful