![]() |
#1 |
Chief Bohemian Misfit
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Embedded fonts & italics
Hey folks! Been quite a while since I did any ebooking, but this past week I thought I'd have a little fun with one, and ran into an odd issue.
I wanted to embed this font into my book... http://www.1001fonts.com/minya-nouvelle-font.html ...and it's nice that it comes with bold and italic versions, and naturally I want those to be used wherever applicable. And so I embedded the regular, bold and italic versions of the fonts in my CSS... Code:
@font-face { font-family: "minya-reg"; font-weight: normal; font-style: normal; src: url("../Fonts/minya-reg.ttf") format("truetype"); -webkit-hyphens:none; -epub-hyphens:none; -moz-hyphens:none; hyphens:none; -moz-font-feature-settings: "hist=1, liga=1, dlig=1"; -ms-font-feature-settings: "hist", "liga", "dlig"; -webkit-font-feature-settings: "hist", "liga", "dlig"; -o-font-feature-settings: "hist", "liga", "dlig"; font-feature-settings: "hist", "liga", "dlig"; } @font-face { font-family: "minya-bd"; font-weight: normal; font-style: normal; src: url("../Fonts/minya-bd.ttf") format("truetype"); -webkit-hyphens:none; -epub-hyphens:none; -moz-hyphens:none; hyphens:none; -moz-font-feature-settings: "hist=1, liga=1, dlig=1"; -ms-font-feature-settings: "hist", "liga", "dlig"; -webkit-font-feature-settings: "hist", "liga", "dlig"; -o-font-feature-settings: "hist", "liga", "dlig"; font-feature-settings: "hist", "liga", "dlig"; } @font-face { font-family: "minya-it"; font-weight: normal; font-style: normal; src: url("../Fonts/minya-it.ttf") format("truetype"); -webkit-hyphens:none; -epub-hyphens:none; -moz-hyphens:none; hyphens:none; -moz-font-feature-settings: "hist=1, liga=1, dlig=1"; -ms-font-feature-settings: "hist", "liga", "dlig"; -webkit-font-feature-settings: "hist", "liga", "dlig"; -o-font-feature-settings: "hist", "liga", "dlig"; font-feature-settings: "hist", "liga", "dlig"; Code:
html>body { font-family: minya-reg, 'Times New Roman', Times, serif; font-size: 124%; } body { font-family: minya-reg, 'Times New Roman', Times, serif; font-size: 100%; line-height: 138%; } Code:
b { font-weight: bold; font-family: "minya-bd";} i { font-style: italic; font-family: "minya-it";} } I've attached here a little test file I made, if you want to take a look at it in ADE or whatever and "see" the problem. Thanks in advance, once again! ![]() |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Why don't you specify the italic and bold version with the same font-family name and adjust the font-style and font-weight to correspond with the actual font? That way the reader should pick the right font anyway. So, like this:
Code:
@font-face { font-family: "minya"; font-weight: normal; font-style: normal; src: url("../Fonts/minya-reg.ttf"); -webkit-hyphens:none; -epub-hyphens:none; -moz-hyphens:none; hyphens:none; -moz-font-feature-settings: "hist=1, liga=1, dlig=1"; -ms-font-feature-settings: "hist", "liga", "dlig"; -webkit-font-feature-settings: "hist", "liga", "dlig"; -o-font-feature-settings: "hist", "liga", "dlig"; font-feature-settings: "hist", "liga", "dlig"; } @font-face { font-family: "minya"; font-weight: bold; font-style: normal; src: url("../Fonts/minya-bd.ttf"); -webkit-hyphens:none; -epub-hyphens:none; -moz-hyphens:none; hyphens:none; -moz-font-feature-settings: "hist=1, liga=1, dlig=1"; -ms-font-feature-settings: "hist", "liga", "dlig"; -webkit-font-feature-settings: "hist", "liga", "dlig"; -o-font-feature-settings: "hist", "liga", "dlig"; font-feature-settings: "hist", "liga", "dlig"; } @font-face { font-family: "minya"; font-weight: normal; font-style: italic; src: url("../Fonts/minya-it.ttf"); -webkit-hyphens:none; -epub-hyphens:none; -moz-hyphens:none; hyphens:none; -moz-font-feature-settings: "hist=1, liga=1, dlig=1"; -ms-font-feature-settings: "hist", "liga", "dlig"; -webkit-font-feature-settings: "hist", "liga", "dlig"; -o-font-feature-settings: "hist", "liga", "dlig"; font-feature-settings: "hist", "liga", "dlig"; } Also, be aware that some readers will ignore font-family set in the body. Also, in your snippet you forgot a closing }... |
![]() |
![]() |
![]() |
#3 | ||
Chief Bohemian Misfit
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Quote:
![]() Quote:
Code:
html>body { font-family: minya, 'Times New Roman', Times, serif; font-size: 124%; } body { font-family: minya, 'Times New Roman', Times, serif; font-size: 100%; line-height: 138%; } Thanks for your help! ![]() |
||
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Code:
@font-face { font-family: "minya"; font-weight: normal; font-style: normal; src: url("../Fonts/minya-reg.ttf") } @font-face { font-family: "minya"; font-weight: bold; font-style: normal; src: url("../Fonts/minya-bd.ttf") } @font-face { font-family: "minya"; font-weight: normal; font-style: italic; src: url("../Fonts/minya-it.ttf") } Code:
body { font-family: "minya"; } Last edited by JSWolf; 01-09-2016 at 01:38 PM. |
![]() |
![]() |
![]() |
#5 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Code:
font-family: "minya-it";
font-weight: normal;
font-style: normal;
|
![]() |
![]() |
![]() |
#6 | |
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
You could also define the bold tag as using font-weight: normal and the italic tag as using font-style: italic, with the caveat that if the user changes the font, they'd lose all formatting that way. ![]() Last edited by dgatwood; 01-08-2016 at 08:52 PM. |
|
![]() |
![]() |
![]() |
#7 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
|
|
![]() |
![]() |
![]() |
#8 | ||
Chief Bohemian Misfit
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
A couple replies here...
Quote:
![]() So are you saying it'd be advisable to add in font-family for all my <p> tags, too? Also, on a separate (but related) note, Woflie wrote... Quote:
Code:
html>body { font-family: minya, 'Times New Roman', Times, serif; font-size: 124%; } body { font-family: minya, 'Times New Roman', Times, serif; font-size: 100%; line-height: 138%; } ![]() Either way, it certainly doesn't hurt to include both, does it (and then also the font-family attributes for <p>, of course)? |
||
![]() |
![]() |
![]() |
#9 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I've a nook STR and it does work with the font-family declared in body in CSS. I think you might have to specify publisher font (or something like that but it's been a while since I used the nook).
|
![]() |
![]() |
![]() |
#10 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I made a slight mistake. You can also drop the font-size 100% from the body style. It's not needed.
|
![]() |
![]() |
![]() |
#11 | |
Chief Bohemian Misfit
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Quote:
And actually, for this particular book I wanted the font to be 124%, so isn't that where it would go? Y'know, it's crazy, I've been doing web design since the mid-1990s, and I've been ebooking (off and on) for several years now, and it never ceases to amaze me how clueless I can be about the most utterly simple things sometimes. :/ |
|
![]() |
![]() |
![]() |
#12 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I find that there are lots of redundant codes being used and I assumed
![]() font-size: 100%, 1em (AKA the body font size) font-weight: normal /*unless in a span that is temporarily dropping the bold */ Wouldn't this work, without the need to modify all the classes? (if minya is the default for most P p {font-family: "minya", serif; } .fooclass {font-family: monospace; font-weight: bold; margin: 2em;} |
![]() |
![]() |
![]() |
#13 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#14 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#15 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre has a serious bug with KF8 & embedded fonts | JSWolf | Conversion | 4 | 07-08-2012 10:26 PM |
Embedded fonts on KF8 & Kindle Touch | dbh2ppa | Amazon Kindle | 5 | 04-27-2012 09:41 PM |
Sigil & Embedded Fonts | Danger | Sigil | 3 | 12-18-2010 09:57 PM |
iPad iBooks, ePub, embedded fonts & encryption | pdurrant | Apple Devices | 37 | 06-08-2010 01:24 PM |
Using embedded fonts with italics only | sherman | Calibre | 2 | 06-27-2009 04:32 AM |