Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 12-19-2022, 11:31 PM   #1
aknight2015
Junior Member
aknight2015 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Dec 2022
Device: Galaxy Tab SM-T500
Using custom embeded font, and improve embedded image quality

I'm trying to use a different font for my ebook. I want to use Alagard font rather than the default font most systems come with. I've embedded the ttf file I need. Also, how do I stop Sigil from over compressing embedded images so that when they are displayed they aren't a pixelated mess.
Code:
/* This defines styles and classes used in the book */
body { margin: 5%; text-align: justify; font-size: medium; background-color: #FCF5E5; }
}
code { font-family: "monospace"; }
h1 { text-align: left; }
h2 { text-align: left; }
h3 { text-align: left; }
h4 { text-align: left; }
h5 { text-align: left; }
h6 { text-align: left; }
h1.title { }
h2.author { }
h3.date { }
nav#toc ol,
nav#landmarks ol { padding: 0; margin-left: 1em; }
nav#toc ol li,
nav#landmarks ol li { list-style-type: none; margin: 0; padding: 0; }
a.footnote-ref { vertical-align: super; }
em, em em em, em em em em em { font-style: italic;}
em em, em em em em { font-style: normal; }
code{ white-space: pre-wrap; }
span.smallcaps{ font-variant: small-caps; }
span.underline{ text-decoration: underline; }
q { quotes: "“" "”" "‘" "’"; }
div.column{ display: inline-block; vertical-align: top; width: 50%; }
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
aknight2015 is offline   Reply With Quote
Old 12-19-2022, 11:58 PM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,228
Karma: 19001261
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Hi aknight2015 - welcome to MR!

For the font, you have to tell the css to use it and where it is located with something like:
Code:
@font-face {
    font-family: 'My Italic';
    font-weight: bold;
    font-style: italic;
    src: url('../Fonts/My_Italic_Bold_Italic.ttf');
}
Then you just add it to the font-family declaration like:

Code:
h1 {font-family: 'My Italic', serif}
For the image compression, Sigil doesn't compress the image files at all - it only displays them how you have defined them in the CSS. I use something along the lines of this to display my images:

Code:
img {max-height:100%; max-width:100%}
div.image {margin:2em}
div.image img {width:100%; max-width:1200px}


<div class="image"><img alt="" src="../Images/yourimage.jpg"/></div>
The max-width is where I put the images actual width in pixels (the images dimensions) to prevent the image from becoming too stretched on large displays.
Turtle91 is online now   Reply With Quote
Advert
Old 12-20-2022, 08:11 PM   #3
aknight2015
Junior Member
aknight2015 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Dec 2022
Device: Galaxy Tab SM-T500
I don't know if I'm doing something wrong or what, but it's not working, at all. Could you actually show what the code looks like inside the CSS? That might help me understand.


Quote:
Originally Posted by Turtle91 View Post
Hi aknight2015 - welcome to MR!

For the font, you have to tell the css to use it and where it is located with something like:
Code:
@font-face {
    font-family: 'My Italic';
    font-weight: bold;
    font-style: italic;
    src: url('../Fonts/My_Italic_Bold_Italic.ttf');
}
Then you just add it to the font-family declaration like:

Code:
h1 {font-family: 'My Italic', serif}
For the image compression, Sigil doesn't compress the image files at all - it only displays them how you have defined them in the CSS. I use something along the lines of this to display my images:

Code:
img {max-height:100%; max-width:100%}
div.image {margin:2em}
div.image img {width:100%; max-width:1200px}


<div class="image"><img alt="" src="../Images/yourimage.jpg"/></div>
The max-width is where I put the images actual width in pixels (the images dimensions) to prevent the image from becoming too stretched on large displays.
aknight2015 is offline   Reply With Quote
Old 12-20-2022, 08:15 PM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,228
Karma: 19001261
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by aknight2015 View Post
I don't know if I'm doing something wrong or what, but it's not working, at all. Could you actually show what the code looks like inside the CSS? That might help me understand.
That is the actual code you put in the css.

You need to make sure you link the css sheet to all the html sheets that you want the css to apply...

Select/highlight all the html files, then right-click and select 'Link Stylesheets...'
Turtle91 is online now   Reply With Quote
Old 12-20-2022, 08:22 PM   #5
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,228
Karma: 19001261
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
CSS:
Code:
@font-face {
    font-family: 'My Italic';
    font-weight: bold;
    font-style: italic;
    src: url('../Fonts/My_Italic_Bold_Italic.ttf');
}

h1 {font-family: 'My Italic', serif}

img {max-height:100%; max-width:100%}
div.image {margin:2em}
div.image img {width:100%; max-width:1200px}
HTML:
Code:
<h1>Heading Level 1 with your specific font</h1>


<div class="image"><img alt="" src="../Images/yourimage.jpg"/></div>
Turtle91 is online now   Reply With Quote
Advert
Old 12-20-2022, 08:50 PM   #6
aknight2015
Junior Member
aknight2015 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Dec 2022
Device: Galaxy Tab SM-T500
This is what my CSS looks like

Code:
/* This defines styles and classes used in the book */
body { margin: 5%; text-align: justify; font-size: medium; background-color: #FCF5E5; }
}
{
   font-family: 'ChomskyRegular';
   font-weight: normal;
   font-style: normal;
   src: url('../Fonts/Chomsky.otf');
}
code { font-family: "ChomskyRegular"; }
h1 { text-align: left; }
h2 { text-align: left; }
h3 { text-align: left; }
h4 { text-align: left; }
h5 { text-align: left; }
h6 { text-align: left; }
h1.title { }
h2.author { }
h3.date { }
nav#toc ol,
nav#landmarks ol { padding: 0; margin-left: 1em; }
nav#toc ol li,
nav#landmarks ol li { list-style-type: none; margin: 0; padding: 0; }
a.footnote-ref { vertical-align: super; }
em, em em em, em em em em em { font-style: italic;}
em em, em em em em { font-style: normal; }
code{ white-space: pre-wrap; }
span.smallcaps{ font-variant: small-caps; }
span.underline{ text-decoration: underline; }
q { quotes: "“" "”" "‘" "’"; }
div.column{ display: inline-block; vertical-align: top; width: 50%; }
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
Still doesn't change the font. I've linked the stylesheets.
aknight2015 is offline   Reply With Quote
Old 12-20-2022, 09:08 PM   #7
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,228
Karma: 19001261
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Did you use “@font-face”….
Turtle91 is online now   Reply With Quote
Old 12-20-2022, 09:32 PM   #8
aknight2015
Junior Member
aknight2015 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Dec 2022
Device: Galaxy Tab SM-T500
Still refuses to work. I've included the attached file to show what I'm dealing with.
Attached Files
File Type: epub 40K_Timeline_Updated_v2.epub (11.19 MB, 143 views)
aknight2015 is offline   Reply With Quote
Old 12-20-2022, 09:40 PM   #9
Foozle
Connoisseur
Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.Foozle ought to be getting tired of karma fortunes by now.
 
Posts: 61
Karma: 221034
Join Date: May 2021
Device: None
Your ../Fonts/ needs to be lowercase ../fonts/
Foozle is offline   Reply With Quote
Old 12-20-2022, 11:20 PM   #10
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,228
Karma: 19001261
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
so....you have set the html tag <code> to have the font...but you don't have any <code> tags in the epub you posted.

Your src reference needs to be the exact same as your epub...capitalization matters.... so, as Foozle mentioned, /fonts/ is not the same as /Fonts/. I used Sigil menu 'Tools/Restructure Epub to Sigil Norm" - although that isn't strictly necessary, it makes the structure and naming of the ePub something I can rely on - and am familiar with.

In this case, I cleaned up some of the duplicate css and moved the font to the header tags.

Code:
@font-face {
  font-family:'Chomsky'; 
  font-weight:normal; 
  font-style:normal; 
  src:url('../Fonts/Chomsky.otf')
}

body{margin:5%; text-align:justify; font-size:medium; background-color:#FCF5E5}

h1,h2,h3,h4,h5,h6{font-family:"Chomsky"; text-align:left}

nav#toc ol,nav#landmarks ol{padding:0; margin-left:1em}

nav#toc ol li,nav#landmarks ol li{list-style-type:none; margin:0; padding:0}

a.footnote-ref{vertical-align:super}

em{font-style:italic}

em em{font-style:normal}

code{white-space:pre-wrap}

span.smallcaps{font-variant:small-caps}

span.underline{text-decoration:underline}

q{quotes:"“" "”" "‘" "’"}

div.column{display:inline-block; vertical-align:top; width:50%}

div.hanging-indent{margin-left:1.5em; text-indent:-1.5em}
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2022-12-20 221724.png
Views:	155
Size:	188.7 KB
ID:	198535  
Attached Files
File Type: epub 40K_Timeline_Updated_v2.epub (11.19 MB, 130 views)
Turtle91 is online now   Reply With Quote
Old 12-20-2022, 11:24 PM   #11
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,228
Karma: 19001261
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
OBTW, your cover image was HUGE! It was 11MB!! I changed it to a jpg and reduced the size slightly...now it is only 230KB
Attached Thumbnails
Click image for larger version

Name:	40K_Timeline_Conver_V1.jpg
Views:	153
Size:	232.4 KB
ID:	198537  
Attached Files
File Type: epub 40K_Timeline_Updated_v2.epub (650.7 KB, 113 views)

Last edited by Turtle91; 12-20-2022 at 11:26 PM.
Turtle91 is online now   Reply With Quote
Old 12-20-2022, 11:42 PM   #12
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,631
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Looking at your CSS, where are you associating the font with the displayed text. The only item I see is associating it with <code> which would generally be used for a monospaced font. Perhaps adding a 'font-family: "ChomskyRegular";' to the body selector might help.

You also have an egregious error in your CSS where you have an stray } after the body selector. In several renderers, this will have your entire stylesheet unused.

Code:
body { margin: 5%; text-align: justify; font-size: medium; background-color: #FCF5E5; }
}
Please note that since you do not include an italic variant of the font, italics will either be faked or the selector will be disregarded.

There are several other errors.

You have an anchor in the nav.xhtml that has no content:
Code:
<li id="toc-li-1"><a href="text/ch001.xhtml#section"></a>
You are using center incorrectly. You could have a paragraph selector with text-align: center or add it as an inline style (blechhh...)

Code:
<center><p><em>For a more complete record, please see Great Crusade Chronology .</em></p></center>
Adding a .center selector in the stylesheet and replacing <center><p> with <p class="center"> and </p></center> with </p> would remove that error.

And, in my personal opinion, Chomsky is an ugly and unreadable font for body text. There's a reason that newpapers did not use that style of font in the body.

Anyhow, I've attached my corrected version of the epub to this message. Note that what I've done to it is strictly my personal choices other than correcting the errors that epubcheck popped up with.

I very strongly recommend that you install the Sigil's epubcheck plugin and make use of it.
Attached Files
File Type: epub 40K_Timeline_Updated_v2.epub (2.31 MB, 127 views)

Last edited by DNSB; 12-20-2022 at 11:50 PM. Reason: Uploaded wrong version without the cover image converted to jpeg
DNSB is offline   Reply With Quote
Old 12-21-2022, 04:34 PM   #13
aknight2015
Junior Member
aknight2015 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Dec 2022
Device: Galaxy Tab SM-T500
I just want to say thank you for all your help. I'm going to download this thread for future reference.
aknight2015 is offline   Reply With Quote
Old 12-21-2022, 11:41 PM   #14
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by DNSB View Post
And, in my personal opinion, Chomsky is an ugly and unreadable font for body text. There's a reason that newpapers did not use that style of font in the body.
For a futuristic look, the OP might want to consider using Eurostile instead. It's not ideal for body text either, but definitely more readable than Chomsky or other blackletter fonts. (Eurostile was used in lots of Scifi movies.)

Quote:
Originally Posted by DNSB View Post
I very strongly recommend that you install the Sigil's epubcheck plugin and make use of it.
Since EPUBCheck will only look for some CSS errors, the OP also might want to install my CSS Validator plugin or simply use Tools > Validate with W3C to check CSS files for errors. (The plugin uses an offline version of the W3C CSS validator.)
Doitsu is offline   Reply With Quote
Old 12-22-2022, 12:34 AM   #15
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,631
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Doitsu View Post
Since EPUBCheck will only look for some CSS errors, the OP also might want to install my CSS Validator plugin or simply use Tools > Validate with W3C to check CSS files for errors. (The plugin uses an offline version of the W3C CSS validator.)
I do use both your CSS validator and the online validator. As most people have noticed by now, I am too lazy to do what the computer can do better so I tend to make use of any tools that allow me to work smarter not harder.

I'm still trying to wrap my mind around what was being attempted with the em, em em em, em em em em em { trying to set italic while em em, em em em em {
were trying to set normal.

An attempt to toggle nested em tags between italic and normal?
DNSB is offline   Reply With Quote
Reply

Tags
embed, font, image quality


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing embeded font in ebook using Sigil 1.9.20 aknight2015 Sigil 1 12-20-2022 01:39 AM
Embedded Style and Embedded Font labels truncated in KA1 sladflob KOReader 2 06-25-2020 09:43 PM
Embeded Italic font not rendered theducks Sigil 6 11-07-2012 08:25 AM
embedded font - now line with embedded font not re-flowing Kaylee Skylyn ePub 23 08-09-2012 08:30 PM
How can we embeded font in Fetch news? attapol Calibre 0 01-03-2010 11:40 AM


All times are GMT -4. The time now is 11:55 AM.


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