Click here to Skip to main content
15,890,438 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: word wrapping Pin
honey the codewitch28-Jul-21 10:25
mvahoney the codewitch28-Jul-21 10:25 
AnswerRe: word wrapping Pin
Eddy Vluggen28-Jul-21 9:46
professionalEddy Vluggen28-Jul-21 9:46 
GeneralRe: word wrapping Pin
honey the codewitch28-Jul-21 10:24
mvahoney the codewitch28-Jul-21 10:24 
AnswerRe: word wrapping Pin
Gerry Schmitz28-Jul-21 10:11
mveGerry Schmitz28-Jul-21 10:11 
GeneralRe: word wrapping Pin
honey the codewitch28-Jul-21 10:23
mvahoney the codewitch28-Jul-21 10:23 
GeneralRe: word wrapping Pin
Gerry Schmitz28-Jul-21 11:30
mveGerry Schmitz28-Jul-21 11:30 
GeneralRe: word wrapping Pin
honey the codewitch28-Jul-21 11:34
mvahoney the codewitch28-Jul-21 11:34 
GeneralRe: word wrapping Pin
Member 1330167928-Jul-21 23:23
Member 1330167928-Jul-21 23:23 
Disregard my pevious answer - that's for HTML only.

If it's for an e-reader you have bigger problems: use a library to do this because there are multiple things involved in flowing text. If you've never used LaTeX you are probably not familiar with all the complexities involved:

1. Font kerning: changes the width of a line.
2. Inter-word spacing: algorithm must ensure no rivers run through paragraphs and edges line up.
3. Paragraph indentation: in literary prose all paragraphs have an indentation.
4. Long word wrapping: You need to use a table of pre-calculated breakpoints that are specific to a glyph.
5. Language: Some languages read right-to-left, and these may be in the middle of a sentence in a language which reads left-to-right.

If you're implementing an E-reader then you need to know all of the following concepts:

1. Kerning
2. Ligatures
3. Unicode code-points
4. Unicode BMP
5. Unicode surrogates
6. Unicode characters
7. Unicode glyphs
8. Rivers/runs in text
9. Struts and rules in text
10. Baselines, Caplines
11. Ascenders, descenders
12. Subpixels
...

and probably a hundred other typesetting things I forgot or don't know about. Flowing text for an E-reader (or PDF, or book or any typesetting) is an entire Phd topic on its own and can take years of work to implement.

It does help if you've used LaTeX in the past, because it chooses good defaults for all of the above, and if you want to change anything you're forced to learn what all those things mean.
GeneralRe: word wrapping Pin
honey the codewitch29-Jul-21 1:05
mvahoney the codewitch29-Jul-21 1:05 
GeneralRe: word wrapping Pin
Member 1330167929-Jul-21 1:40
Member 1330167929-Jul-21 1:40 
GeneralRe: word wrapping Pin
honey the codewitch29-Jul-21 1:56
mvahoney the codewitch29-Jul-21 1:56 
GeneralRe: word wrapping Pin
Member 1330167929-Jul-21 2:49
Member 1330167929-Jul-21 2:49 
GeneralRe: word wrapping Pin
honey the codewitch29-Jul-21 5:41
mvahoney the codewitch29-Jul-21 5:41 
GeneralRe: word wrapping Pin
Member 1330167929-Jul-21 6:39
Member 1330167929-Jul-21 6:39 
GeneralRe: word wrapping Pin
honey the codewitch29-Jul-21 7:06
mvahoney the codewitch29-Jul-21 7:06 
GeneralRe: word wrapping Pin
Member 1330167929-Jul-21 7:20
Member 1330167929-Jul-21 7:20 
GeneralRe: word wrapping Pin
honey the codewitch29-Jul-21 7:28
mvahoney the codewitch29-Jul-21 7:28 
GeneralRe: word wrapping Pin
Rusty Bullet29-Jul-21 5:07
Rusty Bullet29-Jul-21 5:07 
GeneralRe: word wrapping Pin
honey the codewitch29-Jul-21 5:36
mvahoney the codewitch29-Jul-21 5:36 
GeneralRe: word wrapping Pin
Rusty Bullet29-Jul-21 5:37
Rusty Bullet29-Jul-21 5:37 
GeneralRe: word wrapping Pin
CosmoSpacely29-Jul-21 4:45
CosmoSpacely29-Jul-21 4:45 
AnswerRe: word wrapping Pin
MarkTJohnson28-Jul-21 10:48
professionalMarkTJohnson28-Jul-21 10:48 
GeneralRe: word wrapping Pin
honey the codewitch28-Jul-21 11:10
mvahoney the codewitch28-Jul-21 11:10 
AnswerRe: word wrapping Pin
Kornfeld Eliyahu Peter28-Jul-21 20:01
professionalKornfeld Eliyahu Peter28-Jul-21 20:01 
AnswerRe: word wrapping Pin
Rage28-Jul-21 21:38
professionalRage28-Jul-21 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.