MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Locking Fonts? (https://www.mobileread.com/forums/showthread.php?t=341679)

FDPuthuff 09-09-2021 06:15 PM

Locking Fonts?
 
Hey guys,


I'm back.


I am formatting an author's book into both an e-book and a print book.


For the e-book, anywhere one specific font is used, I would like to make it where the e-reader cannot change the font to the reader's desire. The other fonts I don't care about. If I have to lock all of them, not an issue.
  1. Is this possible?
  2. Would I fix this in Sigil? (As opposed to Calibre)
  3. If it is possible, what's this called?
  4. How do you do it, or where can I look? I guess, if I knew the name of the tag or whatever, I'd know where to look.
Any help is appreciated. I'd have searched here for answers, but I am not sure what to call it. :cool:

FDPuthuff 09-09-2021 06:22 PM

OK. I think what I am looking for is Embedding a font.

DiapDealer 09-09-2021 06:48 PM

Embedding is still no guarantee an ereader, or an ereading app won't override your font choice. Outright prevention is not a worthy pursuit. Nor is it very feasible.

phillipgessert 09-09-2021 08:47 PM

Edit: Disregard. Got my wires crossed!

Tex2002ans 09-09-2021 08:56 PM

Quote:

Originally Posted by FDPuthuff (Post 4152956)
For the e-book, anywhere one specific font is used, I would like to make it where the e-reader cannot change the font to the reader's desire.

[...]

1. Is this possible?

No. You cannot keep readers from changing.

What you can do is embed a font, then hope readers allow "Publisher CSS". But users can always override with their own selected fonts, font sizes, line spacing, etc. That's one of the fantastic advantages of ebooks!

Quote:

Originally Posted by FDPuthuff (Post 4152956)
2. Would I fix this in Sigil? (As opposed to Calibre)

Of course. You can use Sigil, Calibre, any combination of tools.

To learn how to do font embedding/subsetting, check out the step-by-step tutorial I wrote a few months ago:

2021: "Japanese characters not showing up on some devices" (Post #4)

It deals with marking up specific languages in a different font, but the same exact logic applies.

Usage Note: I only use embedded fonts in very select cases when dealing with very rarer/obscure Unicode characters (like Polytonic Greek, Maths Symbols, Gibbous Moons 🌔🌖).

JSWolf 09-09-2021 09:20 PM

Quote:

Originally Posted by Tex2002ans (Post 4152974)
Usage Note: I only use embedded fonts in very select cases when dealing with very rarer/obscure Unicode characters (like Polytonic Greek, Maths Symbols, Gibbous Moons 🌔🌖).

How do you get someone uisng a Kindle to select the publisher font?

DiapDealer 09-09-2021 09:23 PM

Quote:

Originally Posted by JSWolf (Post 4152979)
How do you get someone uisng a Kindle to select the publisher font?

Not relevant to a thread about epubs and how to embed fonts using an epub editor.

Tex2002ans 09-09-2021 11:23 PM

Quote:

Originally Posted by JSWolf (Post 4152979)
How do you get someone uisng a Kindle to select the publisher font?

It's been discussed hundreds of times before by Hitch.

You can't.

MOBI/Kindles

You can just hope users select that option, but 99% probably don't.

Or maybe leaving a little note in the frontmatter (or a very first footnote) saying:

"Please enable Publisher Fonts on your Kindle to get the best experience"

but not many people even look there either.

The good thing about Kindles though is they have fallback fonts. So as long as you're using the proper Unicode characters, it has a very high likelihood of displaying.

If you try to embed fonts covering the entire ebook though... (applying to <body> or <p>)... there's a very high likelihood Amazon will strip them on upload. Again, see the Hitch link above.

EPUB

EPUB may be a little bit better on the Publisher CSS front, since the majority of devices/reading-programs follow the standards.

If you design your ebook well, and use the embedded fonts sparingly:
  • rare characters
  • scenebreaks
  • only headings
  • only signs / diary entries

then the embedded font will probably work (and not piss off the user).

But even in EPUB, a portion of users use non-standards compliant readers that completely override everything (Moon+, etc. etc.).

Again, there's no solution. And you definitely can't force a font on the user (this would be disastrous).

* * *

It would be nice if Amazon had some sort of checkbox during upload to say:

"Hey, this book has some rare scientific symbols. Default enable Publisher Fonts when the book is downloaded."

... but I could see that being completely abused by 99% of the authors, especially big publishers. Maybe heuristics would be able to minimize that damage though (maybe only allow it if <10% of the book is in that font).

Side Note: You + me + Hitch even discussed Amazon Publisher Font enabling later in that very same Japanese thread, talking about the B-hat symbol. Most fonts DO NOT display those accents properly, so that's where an embedded mathematical font would be the correct choice.

* * *

Great ebook design though:

KISS (Keep It Simple Stupid) + get the hell out of the way of the user's preferences.

Don't force the constraints of the Print design onto the Ebook. :)

JSWolf 09-10-2021 06:29 AM

Quote:

Originally Posted by Tex2002ans (Post 4153008)
KISS (Keep It Simple Stupid) + get the hell out of the way of the user's preferences.

Don't force the constraints of the Print design onto the Ebook. :)

I've seen way too many eBooks that break these rules. And I've seen a lot of posts asking why some settings cannot be changed that should be able ot be changed.

But as for fonts, on older versions of RMSDK, you could not change the font so the embedded fonts were what you got like it or not. This was the way it was on Sony Readers pre-T series.

The_book 09-11-2021 08:53 AM

I think there is only one way you can do this.
create the image of characters you use, and replace all characters with link to the image.
by this way, you can force person who read your ebook use you font

Quoth 09-11-2021 11:05 AM

I've found that some "popular" Android apps totally ignore embedded fonts, some CAN'T use them at all.
I embed fonts and then check that the book is readable with very limited default fonts.

Quoth 09-11-2021 11:07 AM

Quote:

Originally Posted by The_book (Post 4153374)
I think there is only one way you can do this.
create the image of characters you use, and replace all characters with link to the image.
by this way, you can force person who read your ebook use you font

Which is quite ghastly and akin to producing a fixed layout image based PDF. It's not a real ebook at all. It will only work on certain screen sizes.

Font size selection to suit eyesight won't work either.

FDPuthuff 09-11-2021 07:16 PM

What I ended up doing was setting the CCS for this text to san-serif. I couldn't find an .otf file for the text I wanted anyway. So I passed on embedding and went that direction.
.
What I was dealing with, was representing text on an older computer terminal. It has a very distinctive look. San-serif and mono-spaced.
.
I do appreciate the feedback.:cool:

Tex2002ans 09-11-2021 07:47 PM

Quote:

Originally Posted by FDPuthuff (Post 4153468)
What I ended up doing was setting the CCS for this text to san-serif. I couldn't find an .otf file for the text I wanted anyway. So I passed on embedding and went that direction.
.
What I was dealing with, was representing text on an older computer terminal. It has a very distinctive look. San-serif and mono-spaced.

Source Code Pro is a very good monospace font by Adobe.

Free + open source + SIL license.

They also have Source Serif Pro + Source Sans Pro if you need similar-style matching fonts. (These 2 are now called "Source Serif" + "Source Sans".)

A lot of this monospace + font stuff was also discussed in:

2019: "Font Best Practices"

AlanHK 09-15-2021 04:44 AM

Quote:

Originally Posted by FDPuthuff (Post 4153468)
What I was dealing with, was representing text on an older computer terminal. It has a very distinctive look. San-serif and mono-spaced.


Try font-family: monospace;
That will probably give you a courier-like font. Also try making it bold.

Or, just try <pre> instead of <p> tags, which should give monospaced text.

Or, if there isn't much text, make and place images.
That's what I usually do for a few Chinese characters, as embedding a Chinese font adds like 6MB to a file, even for a few characters, subsetting doesn't seem to work for them.

If your desired font isn't too large, you could specify it and have monospace, or sans-serif, be the fall back if publisher's fonts aren't allowed


.terminal {font-family: MyTerminal-font, monospace; text-align: left; }


Quote:

Originally Posted by FDPuthuff (Post 4153468)
What I ended up doing was setting the CCS for this text to san-serif. I couldn't find an .otf file for the text I wanted anyway.

Look for "pixel fonts".
e.g. https://www.fontspace.com/category/pixel

You can use ttf or otf in ebooks.

JSWolf 09-15-2021 05:11 AM

Do not use <pre>. If the lines are long enough, and the font large enough, the text will not wrap in some cases.

Hitch 09-15-2021 10:55 AM

Quote:

Originally Posted by Tex2002ans (Post 4153008)
It's been discussed hundreds of times before by Hitch.


Don't force the constraints of the Print design onto the Ebook. :)

God, I'd (happily) forgotten that thread. Probably some form of denial. Deliberate forgetting.

Hitch

AlanHK 09-17-2021 11:37 PM

Quote:

Originally Posted by JSWolf (Post 4154333)
Do not use <pre>. If the lines are long enough, and the font large enough, the text will not wrap in some cases.


It's not for paragraphs of prose. It's for PRE-formatted text: where you explicitly put in every linebreak.
The use here is probably for a few words of "output":
Enter password:_
and the like.

But if you might use longer lines, you can also allow wrapping by defining:

pre {white-space: pre-wrap;}

Tex2002ans 09-18-2021 02:25 AM

I agree with JSWolf in this case.

I wouldn't rely on <pre>. Too many readers overflow off the edge of the screen (don't linebreak properly), especially when raising font sizes or reading on skinny screens, etc.

Just rely on simple <p> or <span>, then apply the monospace font to them:

Code:

<p class="terminal">I AM A HUMAN.</p>

<p class="terminal">I AM NOT A ROBOT.</p>

over:

Code:

<pre>I AM A HUMAN.

I AM NOT A ROBOT.</pre>

Back in the 80s/90s, there was a lot of HTML also buried in pre-formatted HTML (manual "justification")... let me tell you, it does not age well on the transfer to modern ebooks/readers.

Note: In ebooks, the only place <pre> + <code> might be acceptable is actual code blocks (like pasting actual C++ or Java code)... but even there, if I was creating the ebook, I'd likely rely on <p> or images for better compatibility.

(Luckily, I haven't had to do that often. The SINGLE programming book I did create code blocks for, I generated PDFs + SVGs + PNGs of the entire syntax-highlighted code block, inserted in the ebook as an image, then linked to the actual github code. It's a formatting mess that I wouldn't wish on anybody.)

AlanHK 09-18-2021 03:17 AM

Quote:

Originally Posted by Tex2002ans (Post 4155096)
I agree with JSWolf in this case.

I wouldn't rely on <pre>.

I didn't say "rely on pre".
That was just the simplest way to do it.

He ignored the rest of my post, which is his SOP.

JSWolf 09-18-2021 05:23 AM

Quote:

Originally Posted by AlanHK (Post 4155106)
I didn't say "rely on pre".
That was just the simplest way to do it.

He ignored the rest of my post, which is his SOP.

I didn't ignore the rest of your post. I just pulled out the one suggestion that's not a good idea because it doesn't work in too many cases.

Quoth 09-18-2021 08:20 AM

I'd not use <pre>; I'd use an explicit paragraph style.

Hitch 09-18-2021 02:16 PM

Quote:

Originally Posted by Quoth (Post 4155168)
I'd not use <pre>; I'd use an explicit paragraph style.

Eh...the problem with that is nothing really "locks in" (no punny irony intended) the look/feel and alignment of text like PRE. You can go for monospace, but still, that's not preformatted.

At least, that's my experience with it. FWIW. I'm sure that there's some mad CSS out there that would prove me wrong.

Hitch


All times are GMT -4. The time now is 09:18 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.