Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-14-2014, 01:37 PM   #1
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
Some mathematical symbols not shown on Kobo Aura

With the programme Sigil, I have created an epub that contains mathematical symbols, coded in html.
On my computer, all the mathematical symbols of the epub are correctly displayed.
On my Kobo Aura, however, four of them are not displayed correctly (they are all shown as a box):
∀ ∃ ∧ ∨
Is that "normal", ie the Kobo Aura simply doesn't display these mathematical, html symbols?
(NB: It does display several other mathematical, html symbols coded in a similar fashion.)
Or could this be due to a bug in the program Sigil?
In all cases, is there a way to fix that?
- By changing the code used for these symbols?
- By tweaking my Kobo Aura? (I'd like to know; but this would not be useful if I want to share the document "with everyone".)

Last edited by 8140david; 04-14-2014 at 01:43 PM.
8140david is offline   Reply With Quote
Old 04-14-2014, 02:06 PM   #2
Ken Maltby
Wizard
Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.
 
Ken Maltby's Avatar
 
Posts: 4,465
Karma: 6900052
Join Date: Dec 2009
Location: The Heart of Texas
Device: Boox Note2, AuraHD, PDA,
It sounds like the Font that your Aura was using might not contain the particular character glyphs.

Some considerations.

Luck;
Ken

Last edited by Ken Maltby; 04-14-2014 at 02:17 PM.
Ken Maltby is offline   Reply With Quote
Advert
Old 04-14-2014, 07:45 PM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
As Ken said, it is probably glyphs missing from the font you are using. From memory, Gothic and Ryumin are the most complete of the supplied fonts. Otherwise, you can add your own font. There has been plenty of discussion on alternate fonts, including https://www.mobileread.com/forums/sho...d.php?t=204363.

Also, fonts are handled a little differently for kepubs than epubs. The kepub renderer handles missing glyphs differently. Sideloading as a kepub might work better with the other fonts.

A little later...

I have a test book from someone here that has various glyphs in it. I added these to it. As I expected, Gothic and Ryumin have the glyphs. The others don't. The kepub version worked but the glyphs were in different fonts to the rest of the text. I assume it uses either Gothic or Ryumin for anything the selected font can't display.

Last edited by davidfor; 04-14-2014 at 08:24 PM. Reason: Added results of testing.
davidfor is offline   Reply With Quote
Old 04-14-2014, 10:59 PM   #4
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
Thanks for the information.

In my epub and on the Kobo Aura, the mathematical symbols that are shown as a box are:
∧ ∧
∨ ∨
∃ ∃
∀ ∀

The mathematical symbols that are shown correctly are:
→ →
↔ ↔
≡ ≡
≤ ≤
&lt; <

In the "epub feature peeker" provided in the forum, it says:
For instance the character 'Latin small letter s with cedilla', namely ş, has the Unicode code point U+015F, and can be encoded in your epub with:
Hexadecimal: &#x015f;
Decimal: ş

So should I use the unicode code for mathematical symbols?
Here are the codes of the symbols that interest me:
http://en.wikipedia.org/wiki/Mathematical_Operators
(NB: This page indicates 3 different codings of characters, as entity, num entity, and hex entity:
http://symbolcodes.tlt.psu.edu/bylan...mathchart.html)

For the 4 problematic symbols above, the Unicodes are respectively:
U+2227 ∧
U+2228 ∨
U+2203 ∃
U+2200 ∀

So the html coding should be this, for the first one?
&#x2227; ∧
I'll try it.

Last edited by 8140david; 04-15-2014 at 01:39 AM.
8140david is offline   Reply With Quote
Old 04-15-2014, 01:21 AM   #5
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
I first thought maybe the problem was coming from Sigil:
I first enter some code in the code display.
Then I check it's fine on the book display and save.
When I return to the code, I often (but not always) see the output and not the code.
For instance, I may see ş in the code, instead of &#x015f;

However, I have confirmed that this isn't the problem:
I have dezipped the epub, replaced in a text editor the mathematical symbols with their proper code (as indicated above).
Rezipped, obtaining a proper epub.
But when transferred to the Kobo Aura, these 4 mathematical symbols are not displayed (only a box appears).

How can I solve that?
I'm looking for a solution that would work on any reader, if possible (not just the Kobo's).
Should insert and/or specify a font in my epub?
But then which?
8140david is offline   Reply With Quote
Advert
Old 04-15-2014, 03:14 AM   #6
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
We're very close to the limit of my knowledge on this. But...

From discussion I have seen in the Sigil and calibre forums, they seem to convert the HTML entities into the unicode characters. Part of the reason is the underlying tools they are using makes this easy to support. But, it seems that these might be better handled by all the different ereaders. Once this is done the two editors (Sigil and the calibre editor) handle the display differently. You have seen how Sigil does it. The calibre editor displays a character with a different colour background. Putting the cursor over it shows information about the character in the status bar of the screen.

From this, I think you can enter whatever is the easiest for you to use when writing the book.

Adding the font might be the only way to guarantee the display. But, from comments here, there might still be problems. I would suggest asking this question in the epub forum. Though it has probably been asked before, so a search might find the answer.
davidfor is offline   Reply With Quote
Old 04-15-2014, 03:18 AM   #7
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
How to add fonts to epub

For the font, I suggest you DejaVu Sans. It's the most complete and free unicode font.

Last edited by Lucas Malor; 04-15-2014 at 03:21 AM.
Lucas Malor is offline   Reply With Quote
Old 04-15-2014, 07:20 AM   #8
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
Thanks.

I've followed these instructions for adding a font to an epub in Sigil:
http://web.sigil.googlecode.com/git/...bed_fonts.html

I've added the font using Sigil (option 'add from existing file' when right clicking on Fonts on the left pannel).

I have defined the font in the stylesheet "style001.css" as indicated, eg:
/* normal case */
@font-face {
font-family: 'DejaVuSans';
src: local(‘☺’), url('../Fonts/DejaVuSans.ttf') format('truetype');
}

And I have defined a class for that font in the stylesheet:
.deja
{
font-family: 'DejaVuSans', sans-serif;
font-weight: normal;
font-style: normal;
}

Each html page of the epub is linked to the stylesheet with:
<head>
<link href="../Styles/style001.css" rel="stylesheet" type="text/css"/>
<title></title>
</head>

I invoke the class deja in the body:
<span class="deja">∃</span>
Indeed, I just want to use the font for the mathematical symbols, not for the rest of the text.

But when I check my epub for W3C compliancy in Sigil, it keeps telling me that the font is unused.

What should I do?
I've looked at many pages by googling, but I don't understand what I'm doing wrong, and nothing is detailed enough to help me on this particular issue.

Last edited by 8140david; 04-15-2014 at 07:32 AM.
8140david is offline   Reply With Quote
Old 04-15-2014, 07:36 AM   #9
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Quote:
Originally Posted by 8140david View Post
src: local(‘☺’), url('../Fonts/DejaVuSans.ttf') format('truetype');
Try using the most simple declaration, with url() only.

Have you controlled the path and name of font and stylesheets are correct?

Last edited by Lucas Malor; 04-15-2014 at 07:53 AM.
Lucas Malor is offline   Reply With Quote
Old 04-15-2014, 07:54 AM   #10
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
My css will be clearer if the name of the class is .maths instead of .deja
(If I ever choose a different font for rendering mathematical symbols.)
I'll fix that.
8140david is offline   Reply With Quote
Old 04-15-2014, 08:55 AM   #11
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
Quote:
Originally Posted by Lucas Malor View Post
Try using the most simple declaration, with url() only.

Have you controlled the path and name of font and stylesheets are correct?
Yes.
I'll try the simple declaration.
But perhaps it's just a bug of Sigil's html checker.
For the characters seem displayed correctly now on my Kobo Aura
8140david is offline   Reply With Quote
Old 04-15-2014, 08:57 AM   #12
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
Next thing would be trimming the DejaVuSans font to keep only the 10 or so mathematical symbols I need (to reduce size).
I've tried to do so online with the font generator here:
http://www.fontsquirrel.com/tools/webfont-generator
But so far, it doesn't trim: the output is as big as the input, whatever 'expert' settings I choose.

Last edited by 8140david; 04-15-2014 at 09:07 AM.
8140david is offline   Reply With Quote
Old 04-15-2014, 09:11 AM   #13
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
Ah! The answer is that I need to select at least one language (English) for the trimming to work.
The operation reduces the 700ko or so of the original font to less than 50ko for the .ttf version and 20ko for the compressed .eot version

Last edited by 8140david; 04-15-2014 at 09:13 AM.
8140david is offline   Reply With Quote
Old 04-15-2014, 09:57 AM   #14
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Well, what if you add other math symbols to the document?

about local(‘☺’), I don't like it. In your case there's no problem, since this is an epub, but if you add it to an html page users have to download the font every time they access it. Since 99% of times the local fonts are good, this is not a good idea IMHO.
Lucas Malor is offline   Reply With Quote
Old 04-15-2014, 10:27 AM   #15
8140david
Connoisseur
8140david began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2014
Device: none
Thanks.
I am now using the simple url declaration you advise, without the 'local'.

The epub in question is fixed (it's an "old" book I'm converting in epub).
So it makes sens to use a small subset of the DejaVuSans font.

***
However, after doing a more systematic tagging of the mathematical symbols and formulas over a whole chapter, I'm back (partly) to the original problem: some fonts are not shown correctly
I'm tired now. Maybe I'll find the solution another day.

So perhaps I should have gone for the simplest, even if it's not the ideal: use the less specific symbols as possible, looking for other ways to express them. Thus:
- The "∧" can be rendered as "&", which is present in usual fonts.
- The "∨"; has no equivalent but can be printed "or".
- Etc.

Last edited by 8140david; 04-15-2014 at 10:48 AM.
8140david is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Aura HD Kobo Glo/Aura/Aura HD future firmware feature request thread arspr Kobo Reader 25 03-26-2015 05:19 AM
KOBO AURA HD vs the KOBO AURA and Paperwhite 1 Josieb1 Kobo Reader 81 05-04-2014 01:52 PM
Dymo tape fix for eBay Kobo Aura and Aura HD covers RobertJSawyer Kobo Reader 2 02-10-2014 10:34 AM
Canadian shoppers discount on kobo aura and aura hd eejit Deals and Resources (No Self-Promotion or Affiliate Links) 4 11-28-2013 01:43 AM
Conversion from azw (Kindle) to epub (Kobo) format with Calibre garbages symbols myildi Conversion 2 09-13-2013 03:19 AM


All times are GMT -4. The time now is 06:50 PM.


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