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

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-02-2018, 06:18 PM   #46
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by frostschutz View Post
found some bugs:

- font size 256pt is understood as 0pt (integer overflow)?
Um, yeah. Silly me wasn't expecting anyone to want a larger font size. That's an easy one to fix.

Quote:
- characters missing when using UTF-8 (string length miscalculation)?
Can you provide a test string, and let me know what characters are missing? Are they missing on a line break by any chance?

Quote:
xyzäöü1234567890 leaves out 890 presumably because 3 umlauts. is worse for CJK characters presumably because 3-4-byte chars instead of 2-byte-chars.
This may be due to string normalization. I may have to look into normalizing the string, or specifying that the caller needs to do it first (It's perfectly valid unicode to store the base character and umlauts as separate codepoints. Normalization combines them to one codepoint). We are using a utf-8 parser, and never assuming max 2 byte characters, so I don't THINK that's the problem.

Otherwise great! I will try to find a way to use this in my FlashCard mod.[/QUOTE]
Thanks for testing. I'm afraid I'm an english only speaker, so it's helpful to get reports from people trying to use different languages!
sherman is offline   Reply With Quote
Old 11-02-2018, 06:18 PM   #47
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,497
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
* Yup, it's an uint8_t, I *think* nothing useful will ever come of >255pt, but I forgot to check, and at the very least we should catch a wrap like that (or just switch to an ushort and forget about it? ) .

* UTF8 handling *looked* sound, but I'll double-check . I did quickly try CJK stuff, but, err, since I don't read it, I failed to notice missing stuff .

EDIT: Too late ;p.

Last edited by NiLuJe; 11-02-2018 at 06:25 PM.
NiLuJe is offline   Reply With Quote
Advert
Old 11-02-2018, 06:25 PM   #48
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by NiLuJe View Post
* Yup, it's an uint8_t, I *think* nothing useful will ever come of >255pt, but I forgot to check, and at the very least we should catch a wrap like that .

* UTF8 handling *looked* sound, but I'll double-check . I did quickly try CJK stuff, but, err, since I don't read it, I failed to notice missing stuff .

EDIT: Too late ;p.
Do you want to look at it, or should I?
sherman is offline   Reply With Quote
Old 11-02-2018, 06:38 PM   #49
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Quote:
Originally Posted by sherman View Post
Can you provide a test string, and let me know what characters are missing?
There are no characters missing, it just stops printing early for some reason.

Print '漢' and it shows 漢

Print '漢字' and it still shows 漢

Print '漢字--' and it shows 漢字

Print '漢字----' and it still shows 漢字

Print '漢字-----' it shows 漢字-

It's like it knows it has to show 2 characters, then calls it quits after processing 3 bytes (which is only one character).

漢字 is six bytes and additional - character only shows up when providing a 7 character string. So instead of showing 7 characters as requested, it shows 7 bytes.

And providing 漢字-- (4 characters string) causes the next character to show up (漢字) because the first character only consumed 3 bytes.

So much for my guess without looking at any code at all
frostschutz is offline   Reply With Quote
Old 11-02-2018, 06:49 PM   #50
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
@NiLuJe

255pt is actually about the same size as I use here ( flashcard example for 森 character https://www.mobileread.com/forums/at...6&d=1540719095 )

But this is on my H2O, wouldn't it need to be larger on 8"-10" or higher res readers? (Is pt DPI dependent or just pixels?)

This just to illustrate why I wanted to print a huge character... I wouldn't have complained if 65536pt -> 0pt. I just went to 256pt by trial&error cause 32 64 128 was too small after all

Last edited by frostschutz; 11-02-2018 at 06:51 PM.
frostschutz is offline   Reply With Quote
Advert
Old 11-02-2018, 06:54 PM   #51
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by frostschutz View Post
@NiLuJe

255pt is actually about the same size as I use here ( flashcard example for 森 character https://www.mobileread.com/forums/at...6&d=1540719095 )

But this is on my H2O, wouldn't it need to be larger on 8"-10" or higher res readers? (Is pt DPI dependent or just pixels?)

This just to illustrate why I wanted to print a huge character... I wouldn't have complained if 65536pt -> 0pt. I just went to 256pt by trial&error cause 32 64 128 was too small after all
I'll answer, because i know. The size is DPI aware, that's why I chose points, instead of pixels for size, so that users would see (roughly) the same font size, regardless of screen DPI.
sherman is offline   Reply With Quote
Old 11-02-2018, 06:58 PM   #52
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,497
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@sherman: I'll be busy for the next few hours, so, go ahead .

Initial findings would point to the fact that the various c_index vs. chars_in_str checks are wrong, because c_index is the *byte* index in the string array, while chars_in_str is the amount of unicode "characters".
Since bytes >= unicode chars, drift slowly accumulates as more multi-byte characters are encountered, and we abort the loop early.

Of lesser import, the md parser stuff is also massively not unicode aware, but we already knew that ;p.

----

And, yeah, now that I've checked, I can see somewhat valid use cases for >255pt, so that's an easy fix, at least .

Last edited by NiLuJe; 11-02-2018 at 07:03 PM.
NiLuJe is offline   Reply With Quote
Old 11-02-2018, 07:00 PM   #53
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by NiLuJe View Post
@sherman: I'll be busy for the next few hours, so, go ahead .

Initial findings would point to the fact that the various c_index vs. chars_in_str checks are wrong, because c_index is the *byte* index in the string array, while chars_in_str is the amount of unicode "characters".
Since bytes >= unicode chars, drift slowly accumulates as more multi-byte characters are encountered.

Of lesser import, the md stuff is also massively not unicode aware, but we already knew that ;p.
*facepalms*
sherman is offline   Reply With Quote
Old 11-02-2018, 07:21 PM   #54
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
well, I won't complain about the md stuff

I'm happy already to have it work as well as it does, half expected it to not handle megabytes-large fonts but it works just fine

this is a huge step forward, thank you so much
frostschutz is offline   Reply With Quote
Old 11-02-2018, 08:08 PM   #55
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Hi frostschutz,

Here's a test version of FBInk, which hopefully fixes the issues you've raised. Can you test and let me know if it does? Especially the CJK stuff.

It allows for font sizes greater than 255 as well, although be aware, your print area needs to be large enough to support it, otherwise nothing will show on screen.
Attached Files
File Type: zip FBInk-TestVers.zip (511.3 KB, 438 views)
sherman is offline   Reply With Quote
Old 11-02-2018, 08:37 PM   #56
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
it seems to work fine, thank you
frostschutz is offline   Reply With Quote
Old 11-02-2018, 08:38 PM   #57
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by frostschutz View Post
it seems to work fine, thank you
No problem... It was my own silly mistake that caused the issue in the first place.

EDIT: And PR submitted to NiLuJe

Last edited by sherman; 11-02-2018 at 08:43 PM.
sherman is offline   Reply With Quote
Old 11-03-2018, 07:45 AM   #58
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Also, a quick note on the md parser not being unicode aware, from my point of view, I don't think it needs to be. It just iterates over bytes, and if it sees the ASCII '*' or '_' characters, it triggers an action. Otherwise, the text stream is seen as an opaque sequence of bytes, because it doesn't care about them.

In other words, it should handle any input you give it, regardless of whether it's english or not. On the other hand, it has no concept of whether a given language even supports bold/italics, but it's up to the user to figure that one out in my opinion.
sherman is offline   Reply With Quote
Old 11-03-2018, 12:43 PM   #59
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,497
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@sherman: Yeah, for some reason, I was worried it'd flag stuff in-between multi-byte characters, but no, after a good night's sleep and some testing, things appear to work well (at least with Latin scripts, so, 2 or 3 bytes) .

This just made me mad at Kobo again for their broken libc because I have to swap to a custom busybox shell to actually be able to input utf8 in my terminal, but, oh, well .

Last edited by NiLuJe; 11-03-2018 at 01:06 PM.
NiLuJe is offline   Reply With Quote
Old 11-03-2018, 06:39 PM   #60
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by NiLuJe View Post
@sherman: Yeah, for some reason, I was worried it'd flag stuff in-between multi-byte characters, but no, after a good night's sleep and some testing, things appear to work well (at least with Latin scripts, so, 2 or 3 bytes) .

This just made me mad at Kobo again for their broken libc because I have to swap to a custom busybox shell to actually be able to input utf8 in my terminal, but, oh, well .
That's the nice property that UTF-8 has. Any byte outside the ASCII range starts with 1xxxxxxx, so a valid ASCII character will never be found within a multi-byte sequence.
sherman is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Aura HD Small tool for filling book library in Kobo Aura Paxerus Kobo Developer's Corner 2 12-31-2013 08:05 PM
Small print Broadback Conversion 12 12-12-2011 03:31 PM
Small Tool to change book order (PRS-x50) goaspy Sony Reader 113 10-14-2011 04:28 PM
small print breezeman Introduce Yourself 13 07-03-2011 10:02 AM


All times are GMT -4. The time now is 04:15 AM.


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