|
I just don't have the space for it, and I can't count on being online.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: What would you do? I'd not wrap at all. Cost-wise the most efficient choice.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
So like, the edges of the word extend of the sides of the page? I'm not sure I can get away with that, since it's for an e-reader, although I wonder if they wouldn't put invisible unicode syllable breaks in long words. I wouldn't want want count on it. Hmmmm.
Real programmers use butterflies
|
|
|
|
|
Supercalifrag...
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
It's for a e-reader for reading books. I can't do that.
Real programmers use butterflies
|
|
|
|
|
Start a dictionary ... you already have a word. I have spelling tables with up to 70,000 entries; you can manage one word?
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I don't have the space for a dictionary. I just don't. I'm sweating 30kB here 30kB there for my state tables, and then I have 250kB for my default fonts, which i actually have zipped, and then embedded the compressed result into my code as a C array.
But I don't have room left over for much.
Edit: I think I'm just going to hard wrap
Real programmers use butterflies
|
|
|
|
|
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.
|
|
|
|
|
Find me a library for this that works on the Arduino framework.
1. Done
2. Not
3. Done
4. Not
5. Done
6. Done
7. Done (although i think you mean ttf/otf glyphs
8. Not
9. Not
10.Done
11.I don't know what that is
12. If you mean fractional pixels or anti-aliasing, done
Real programmers use butterflies
|
|
|
|
|
Quote: Find me a library for this that works on the Arduino framework.
Maybe you should tell your client that the project they contracted you for is not completely realisable on their choice of hardware. Sure, you can get part of the way there on an atmega platform but it may not match their expectations.
Or maybe get them to scale their requirements down to exclude extended unicode characters and exclude any sort of typesetting rules; just render text instead of typesetting it.
Most (if not all) times my clients let me choose the hardware anyway (they set price restrictions and I tell them what is capable at that price) so it shouldn't really be a problem having this discussion with your client.
|
|
|
|
|
I could tell my client that but it's not true, and I wouldn't believe myself (I'm the client) anyway.
I've got unicode, i'm working on the typesetting. It's not that the device isn't capable - I think I've written enough of the code to prove that the ESP32 can do it. It's just that I don't know the behaviors of all of it - not that I'm trying to implement all of it - just enough to show most epubs mostly correctly.
Real programmers use butterflies
|
|
|
|
|
Quote: I could tell my client that but it's not true,
You appaer to be in agreement with this statement of mine:
Quote: Sure, you can get part of the way there on an atmega platform
So, yeah, that's completely true and factual - you can definitely get part of the way there! I'm guessing that the easiest bits can be done (inter-word spacing and hyphenation at syllable boundaries), but anything else you add in is going to result in a ragged right-edge.
If you are okay with a ragged right edge, then it all becomes doable on an ESP32 (that's like what, 80KB RAM?)
|
|
|
|
|
Adding, you didn't mention an atmega before so I'm not sure what you're quoting. In any case I didn't agree or disagree with that statement because you didn't make it.
This is what I responding to:
Maybe you should tell your client that the project they contracted you for is not completely realisable on their choice of hardware.
Real programmers use butterflies
|
|
|
|
|
Quote: Adding, you didn't mention an atmega before so I'm not sure what you're quoting.
I'm quoting this post over here, which as you can see contains the sentence you missed:
The Lounge[^]
Quote: This is what I responding to:
Maybe you should tell your client that the project they contracted you for is not completely realisable on their choice of hardware.
Seems you're in agreement with that too, since you say:
Quote: not that I'm trying to implement all of it - just enough to show most epubs mostly correctly.
That's what "not completely realisable" means.
|
|
|
|
|
First of all, you never mentioned the atmega in that post. I just looked at the link you gave me. I didn't miss a sentence. What was being discussed was the Arduino framework. It is only incidently related to an atmega in that an atmega will run it. It's not the only thing that does.
Member 13301679 wrote: That's what "not completely realisable" means.
It's what this means
Member 13301679 wrote: Maybe you should tell your client that the project they contracted you for is not completely realisable
I bolded the relevant bits. You forgot the operative part. I was never contracted to build a 100% to spec e-reader.
Real programmers use butterflies
|
|
|
|
|
Quote: First of all, you never mentioned the atmega in that post. I just looked at the link you gave me. I didn't miss a sentence. What was being discussed was the Arduino framework. It is only incidently related to an atmega in that an atmega will run it. It's not the only thing that does.
Okay, what do you see as the second sentence in
[^]?
Quote:
Member 13301679 wrote:
That's what "not completely realisable" means.
It's what this means
Member 13301679 wrote:
Maybe you should tell your client that the project they contracted you for is not completely realisable
I bolded the relevant bits. You forgot the operative part. I was never contracted to build a 100% to spec e-reader.
The operative part being that you don't do this for money? It's damn funny then that you lecture some who does get paid for embedded stuff you are trying to learn
Anyway, back to the topic, you bolded the part where I said it's not compeletely realisable, and then you said you can do most of it, mostly.
Sounds like you agree but can't bring yourself to admit it. No as much as I like to see people whine that "I can't see the word atmega in a paragraph of two sentences" when given a direct link, I cannot entertain your self-humiliation much longer - as a professional I have paying clients to attend to. You'd do the same once you start getting paid for your "work".
|
|
|
|
|
I like that you think I'm trying to learn. I get paid to write embedded. I'm done with you. I have no patience for hubris.
Real programmers use butterflies
|
|
|
|
|
Honey, ascenders and descenders are letters like 't', 'l', 'h' that ascend above a standard 'a' type character and descenders are 'p', 'q', 'y' that descend below a standard 'a' type character.
|
|
|
|
|
Oh I thought it was going to be something weird.
Yeah my stuff does that. It's basic truetype. you couldn't render fonts without it.
Real programmers use butterflies
|
|
|
|
|
Jargon is always scary until you know what it means!
|
|
|
|
|
There is a pre baked library that covers many of these problems:
http://site.icu-project.org/
Do not underestimate the weedy-ness of wrapping text. Check out some of the South Asian scripts. Thai, for example, has no spaces.
Another strategy would be to scroll the too-long word. Think 1980's 16 character LED and LCD displays.
|
|
|
|
|
Fixed width fonts, know how many across, break there.
Is that an option?
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
Not really. The whole thing is open type/true type and using digital typesetting. Worse, there are default fonts but they can be overridden by the EPUB via CSS.
And really the problem is knowing where I should break the word. I could do it right in the middle but that seems less than good.
Real programmers use butterflies
|
|
|
|
|
As you are already neck-deep into CSS you should learn from it...
word-break: break-all;
To prevent overflow, word breaks should be inserted between any two characters (excluding Chinese/Japanese/Korean text).
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
honey the codewitch wrote: In the real world, I'd just find a syllable and then hyphenate
What about hyphenating at random places ? How often do you need it ?
|
|
|
|