Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-25-2024, 12:48 PM   #1
Yihan-labs
Junior Member
Yihan-labs began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2024
Device: reMarkable
Noto Sans Mono CJK font missing in code view font

Hello!

Thanks for creating and maintaining Sigil which is an amazing piece of software.

Today, when editing XHTML, I found that the mono font in the code view does not line up Kanji/汉字 and English characters.

From searching online, I found that using Noto Sans Mono CJK will solve the issue. Since I ran Sigil on a Linux-based system, this font is already available on my system.

However, I cannot set the Noto Sans Mono CJK on "Preferences->Code view" despite the font being available in "Preferences->Main UI". The font is listed under "Insert Special Characters" but not under "Monospaced Code font".

I think this should be an easy fix. Maybe listing all the fonts with "mono" in their name under the font selection.

Cheers.
Yihan-labs is offline   Reply With Quote
Old 10-25-2024, 01:20 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,771
Karma: 6000000
Join Date: Nov 2009
Device: many
Then for some reason Qt does not think it is a monospaced font. Thre really is not anything we can do to fix this from our end. You will need to use font-forge to "fix" that font to make it properly indicate it is a monospaced font if that is indeed the case. The actual font family name or file name is not sufficient.
KevinH is offline   Reply With Quote
Advert
Old 10-25-2024, 01:21 PM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,577
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The font files themselves need to tell Sigil/Qt that they're a monospaced font. Noto Sans Mono CJK must not be doing that properly. We're probably not going to change Sigil to overcome a font's shortcomings by trying to parse file names.
DiapDealer is online now   Reply With Quote
Old 10-26-2024, 12:19 AM   #4
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,288
Karma: 169098402
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For what it may be worth, the Noto Sans Mono fonts have glyphs that do not fit the fixed width. A check using fc-scan does not show the expected spacing = 100 for a monospaced font. Using FontForge under Windows under Font Information => OS/2 => Panose => Proportion does not show Monospaced.

There have been quite a few discussions about how QT decided a font is monospaced and issues with the Noto San Mono fonts.

If anyone is suffering from insomnia, you can check Noto Sans Mono doesn't declare spacing property on GitHub especially the last comment.

And continuing on, this item from QT's bugs: Qt fails to consider dual-width fonts mono with fontconfig.

Last edited by DNSB; 10-26-2024 at 12:30 AM. Reason: Added link to GitHub discussion
DNSB is offline   Reply With Quote
Old 10-26-2024, 02:30 AM   #5
Yihan-labs
Junior Member
Yihan-labs began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2024
Device: reMarkable
Thank you for your reply.
After some searching, I found this gnome thread also listing a similar issue: https://gitlab.gnome.org/GNOME/gnome.../-/issues/7960

Quote:
Noto Sans Mono CJK must not be doing that properly. We're probably not going to change Sigil to overcome a font's shortcomings by trying to parse file names.
Quote:
The actual font family name or file name is not sufficient.
I see that it's not a good idea to filter fonts by name and it's not Sigil's responsibility to determine if a font is monospaced. Both the "fc-list :mono" and "pango-list" determine monospace by checking a spacing property of 100 in fc-scan, but this does not suit the case of Noto Sans Mono CJK because the Kanji characters are aligned to the width of two ASCII characters. As shown below:


The text is going to look terrible if we change the font to fit the "spacing property of 100" criteria AND it is going to take a long time for people to change this criterion because of how the open-source community works.

It could be helpful to make a toggle for the mono font filter, as suggested in the gnome thread above. This will also solve the issue in this thread of 2019: https://www.mobileread.com/forums/sh...d.php?t=320386. But I understand that this issue is not very urgent, and the developer's time is limited.

I spent some time finding the correct field for the font family settings in the sigil.ini, it is under a different name compared to the 2019 thread above, the names are as follows:
Code:
$ ack font '~/.var/app/com.sigil_ebook.Sigil/data/sigil-ebook/sigil/'
~/.var/app/com.sigil_ebook.Sigil/data/sigil-ebook/sigil/sigil.ini
516:cv_dark_font_family_standard=Nimbus Mono PS
517:cv_dark_font_size=14
537:original_ui_font="Cantarell,11,-1,5,50,0,0,0,0,0"
542:preview_font_family_sans_serif=C059
543:preview_font_family_serif=Times New Roman
544:preview_font_family_standard=C059
545:preview_font_size=16
Current solution:
  1. Select Edit > Preferences > Open Preferences Location.
  2. Close Sigil.
  3. Open sigil.ini
  4. Search and replace the following entry:
    Code:
    cv_dark_font_family_standard=Noto Sans Mono CJK TC
  5. Save sigil.ini

Now the text looks much better, before this the code view had different line spacing, is like a giant building with each window having a different width and height.
Yihan-labs is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code view what font? JSWolf Editor 2 11-23-2023 09:47 AM
Code View font choices tetrault Sigil 3 05-28-2019 03:11 PM
Italic missing with Sans font Armaell Conversion 4 11-20-2015 03:34 AM
How do I change the syntax colouring and increase the font size in the Code View? nicciglen Sigil 5 02-08-2012 09:34 AM
Changing font for code view mode matthewyi Sigil 2 11-05-2009 02:20 PM


All times are GMT -4. The time now is 06:17 AM.


MobileRead.com is a privately owned, operated and funded community.