rizonesoft / Notepad3

Notepad like text editor based on the Scintilla source code. Notepad3 based on code from Notepad2 and MiniPath on code from metapath. Download Notepad3:
https://www.rizonesoft.com/downloads/notepad3/
Other
5.07k stars 335 forks source link

Use different fonts for Latin & Asian text (like Office Word / WPS) #2664

Closed userzzzq closed 2 years ago

userzzzq commented 4 years ago

Snipaste-2020-08-16-16-19-23

hpwamr commented 4 years ago

Hello @zhuoziqiang , I will investigate, I do not know if this possible ?

Just keep in mind that Notepad3 is a "Simple Text Editor" but "Coder-Oriented" based on the file type (file extension) and does not function as a "Text Processor" like MS Word. 🤔 (see https://github.com/rizonesoft/Notepad3/issues/1850#issuecomment-568405699 and more...)

RaiKoHoff commented 4 years ago

@zhuoziqiang : Do you think of User Interface Font or editing document font ?

Referring to document fonts:

This fonts are controlled via styles (Customize Schemes... dialog). Best would be to create your own scheme by exporting a scheme into themes sub-directory (-> Chinese.ini). After loading this new scheme, you can configure all fonts according to your needs. Then you have to switch between Standard(English) and Chinese(Chinese) theme according to your needs.

To mix English and Chinese with different fonts within the same document, you need a "Language Lexer 'Text'", which is able to distinguish between Chinese and English using different fonts for each - we don't have this. A workaround would be to configure a simple lexer to have a Chinese font for plain text and an English font for comments. The drawback of this (beside set all other lexer specific styles to plain text Chinese font, is, the Englisch text font is only available in comments.

RaiKoHoff commented 4 years ago
  1. Simple switch method: Select2nd Common Base in Customize Schemes... and change font

image

Use STD/2ND in status bar to switch between different fonts.

  1. Full Control on fonts: Create your own Chinese theme and switch between Schemes:

image

image

lss4 commented 3 years ago

Recently I discovered that Notepad3 is trying to use a wrong font (which has some incorrect glyphs for specific characters) for some reasons. Previously it used SimSun for Chinese text which is what I wanted.

I'm yet to know how to properly set up FontLink in the Windows registry to get font mapping working as intended... Just tried that a bit and didn't work. Asian fonts can be very complicated to tweak on a non-CJK Windows installation.

Does Notepad3 have its own rules regarding which font to pick if the font specified can't display the character, or that it follows whatever rule Windows currently uses?

hpwamr commented 3 years ago

Hello @lss4 , Can you show us some pictures/texts with incorrect glyphs and what it should be?

lss4 commented 3 years ago

Okay. notepad3-chartest This is the current state. I'm using MxPlus IBM VGA 8x16 font. The Chinese text is currently being displayed using a font which I'm yet to know its name, with some incorrect glyphs for certain characters. notepad3-chartest-simsun This is the SimSun font. Back then with the font I intend to use (MxPlus/PxPlus fonts), this SimSun font was picked for displaying Chinese text which looks better in overall (this is presented using the 2nd Common Base option).

Not sure if it's possible to specify multiple fonts in the option string.

RaiKoHoff commented 3 years ago

Please keep in mind, that there is also a difference between different Rendering Technologies. Menu -> Settings -> Technology -> ( DirectWrite vs. GDI (no ligatures) ) , using DirectWrite, you are also able to specify fractional font size, which can make a difference in visual impression.

RaiKoHoff commented 3 years ago

@lss4 : Did you check that the different visual impression is not related to the rendering technology?

lss4 commented 3 years ago

Sorry for haven't checked about this. You're right about the difference between rendering technologies.

gdi-no-ligature

This is taken on a recent Notepad3 build, when Rendering is set to GDI (no ligatures). Yes, this is the way I wanted.

EDIT: The GDI (no ligatures) mode worked around the font issue I'm having, but it introduced a new one: the font I'm using (MxPlus IBM VGA 8x16) looks bad in italic (mainly for code comments), with rough edges which are smoothed when using DirectWrite rendering modes.

So again, is there a way to actually control which fonts would be used when using DirectWrite?

hpwamr commented 3 years ago

Hello @zhuoziqiang , As far as I'm concerned, I think you (requester) can close this issue...

RaiKoHoff commented 3 years ago

@lss4 : There is no such thing like Rendering Technology dependent font switching - sorry - they have to be set independently.

The "good old GDI" rendering technology seems to have a better "visual quality" in displaying some standard fonts. Unfortunately the GDI Technology is not able to display ligatures or higher Unicode code-points. Small optimizations can be made by using fractional font size (e.g. size:11.3) for DirectWrite (Customize Schemes... only, not Font Selection Dialog).

Maybe you can find a DirectWrite optimized MxPlus IBM VGA 8x16 font somewhere ?

lss4 commented 3 years ago

@lss4 : There is no such thing like Rendering Technology dependent font switching - sorry - they have to be set independently.

The "good old GDI" rendering technology seems to have a better "visual quality" in displaying some standard fonts. Unfortunately the GDI Technology is not able to display ligatures or higher Unicode code-points. Small optimizations can be made by using fractional font size (e.g. size:11.3) for DirectWrite (Customize Schemes... only, not Font Selection Dialog).

Maybe you can find a DirectWrite optimized MxPlus IBM VGA 8x16 font somewhere ?

Okay... I think the issue can be closed as it's very unlikely this can be solved on this side.

It's not impossible, though. One can create a new font by combining the two fonts into one, such as using SimSun as a base, take all the glyphs off MxPlus IBM VGA 8x16 and replace the respective ones there. As the new font contains all the glyphs involved, it would naturally solve the issue as all the characters could then be displayed without relying on a fallback.

That would be a bit hacky and can take a while depending on the font, but that was how I used to "patch" WarCraft III into being able to display characters of other languages (instead of displaying them as whitespaces), while retaining the original user experience (FYI, that game uses Friz Quadrata TT font).

RaiKoHoff commented 3 years ago

@lss4 : "Combining two fonts" sounds pretty cool. I don't know, if the license model of the fonts allow to publish the "combined" font, e.g. here on GitHub (like the creator of "Fixedsys Excelsior").

lss4 commented 3 years ago

@lss4 : "Combining two fonts" sounds pretty cool. I don't know, if the license model of the fonts allow to publish the "combined" font, e.g. here on GitHub (like the creator of "Fixedsys Excelsior").

IANAL, but I think it depends on the fonts used. If all the fonts involved are free to use (according to their respective licenses) it's probably okay as long as the sources are correctly credited.

Some fonts are covered by commercial licenses and can be problematic to distribute them directly, but it's probably okay to release the modifications as patches so users are still required to provide the font themselves, like how Nerd Fonts do for fonts that are covered by non-free licenses.