View Single Post
Old 04-18-2025, 11:39 AM   #4
jindroush
Connoisseur
jindroush doesn't litterjindroush doesn't litter
 
Posts: 94
Karma: 104
Join Date: Nov 2014
Device: Kindle
Quote:
Originally Posted by kovidgoyal View Post
This has nothing to do with fonts and everything to do with kindle firmware. only amazon can explain the kindle's behavior.
Yes and no. Now I was able to get to the root cause. It's different CSS font declaration in conversion, depending if the font comes from system or from word.

When font is NOT embedded in Word, and Calibre finds it in the system, such CSS is created by Calibre conversion process:
Code:
@font-face {
  font-family: "Source Serif 4";
  font-weight: normal;
  font-style: normal;
  font-stretch: normal;
  src: url(fonts/Source-Serif-4-Regular.ttf);
}
@font-face {
  font-family: "Source Serif 4";
  font-weight: normal;
  font-style: italic;
  font-stretch: normal;
  src: url(fonts/Source-Serif-4-Italic.ttf);
}
@font-face {
  font-family: "Source Serif 4";
  font-weight: bold;
  font-style: normal;
  font-stretch: normal;
  src: url(fonts/Source-Serif-4-Bold.ttf);
}

When font IS embedded in Word, and Calibre reads it from DOCX, only this CSS is created:
Code:
@font-face {
  font-family: "Source Serif 4";
  src: url(fonts/Source_Serif_4_-_Regular.ttf);
}
@font-face {
  font-family: "Source Serif 4";
  src: url(fonts/Source_Serif_4_-_Italic.ttf);
  font-style: italic;
}
@font-face {
  font-family: "Source Serif 4";
  src: url(fonts/Source_Serif_4_-_Bold.ttf);
  font-weight: bold;
}

When I add
Code:
font-weight: normal;
for non-Bold fonts, it works and Kindle is not mismatching the fonts anymore (don't ask me why)


Do you think Calibre can always create 'full' CSS @font-face for both embedded and non-embedded fonts?
jindroush is offline   Reply With Quote