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)

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.