Bug 695936 - font-family cannot read any particular font (embedded in ePub document or not)
Summary: font-family cannot read any particular font (embedded in ePub document or not)
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: epub (show other bugs)
Version: master
Hardware: Other All
: P4 normal
Assignee: MuPDF bugs
URL:
Keywords:
Depends on:
Blocks: 695935 695924
  Show dependency tree
 
Reported: 2015-04-18 04:16 UTC by Pablo Rodríguez
Modified: 2016-01-22 03:49 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
book with sans-serif font (3.80 KB, application/epub+zip)
2015-04-18 04:16 UTC, Pablo Rodríguez
Details
ePub file with actual font invocation (33.88 KB, application/epub+zip)
2015-05-02 11:33 UTC, Pablo Rodríguez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pablo Rodríguez 2015-04-18 04:16:31 UTC
Created attachment 11598 [details]
book with sans-serif font

In the attached ePub file, the CSS specifies the body font family as sans-serif:

   body {
    font-family: FreeSans, sans-serif;
    }

I’m afraid that mupdf-1.7 simply ignores it.
Comment 1 Pablo Rodríguez 2015-05-02 11:33:18 UTC
Created attachment 11637 [details]
ePub file with actual font invocation

I have discovered that the following code works with current master:

    .firstfontface {
        font-family: monospace;
        }

Other font generic names such as "serif" or "sans-serif" work, unless they are preceded by an actual font name. This is the reason why the font selection doesn’t work in the previous ePub:

    body {
        font-family: FreeSans, sans-serif;
        }

Even if mupdf cannot find the first typeface, it should try the next one.

And font invocation by concrete font name doesn’t work. Either the font is embedded in ePub file or it has to be from OS:

@font-face {
	font-family: myCousine;
	font-style: normal;
	font-weight: normal;
	src:url("Cousine-Regular.ttf");
	}

.secondfontface {
	font-family: Cousine;
	}

.thirdfontface {
	font-family: myCousine;
	}

Could you fix this?

Many thanks for your help.
Comment 2 Pablo Rodríguez 2015-11-10 09:14:23 UTC
Tor, summarizing the issue, mupdf (your current master c1ecd40) only reads serif, sans-serif or monospace from font-face.

Any actual font (from system in X11 or embedded in ePub with @font-face) is simply ignored.
Comment 3 Pablo Rodríguez 2015-12-07 02:50:45 UTC
Tor,

the following document (http://www.boe.es/buscar/epub/2007/BOE-A-2007-22439-consolidado.epub) contains the CSS code:

    body { font-family: Arial, sans-serif; }

mupdf-x11 current master ignores both fonts (Arial isn’t embedded). It displays the serif font.

http://www.boe.es/legislacion/codigos/abrir_epub.php?fich=034_Codigo_Civil_y_legislacion_complementaria.epub embeds the fonts, but mupdf-x11 ignores both fonts again and displays the serif font.

Before there is a proper implementation for font-family, would it be possible that mupdf ignores what it cannot handle and displays the fonts that handles?

(I mean, Arial should be rejected and sans-serif used for text display in the CSS code above.)
Comment 4 Tor Andersson 2016-01-22 03:49:20 UTC
commit f501211e904d2c01e47b03e774ffc6f93faeae25
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Fri Jan 22 12:00:55 2016 +0100

    epub: Implement @font-face rules.