电子书阅读器未捕获 epub 文件的嵌入字体 [英] Ebooks reader not capturing embedded font for epub file

查看:15
本文介绍了电子书阅读器未捕获 epub 文件的嵌入字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 epub 阅读器有问题,它可以正确显示所有内容,但没有捕获 CSS 文件中的嵌入字体.

I have a problem in my epub reader, it displays all content correctly but it's not capturing the embedded font in the CSS file.

当我在其他阅读器上运行相同的文件时,会显示嵌入的字体,但是当我在 Firefox 等浏览器之一上运行 html 文件时,它会显示与我的应用程序相同的结果,并且不会显示嵌入的字体.

When I run the same file on other readers the embedded font is displayed but when I run the html file on one of the browsers like Firefox it shows the same result as my app and it doesn't display the embedded font.

这是一个示例 html 内容:

Here is a sample html content:

<html  dir="rtl"   xml:lang="ar"   lang="ar"  xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=1332,height=794" />
        <title>the-title-3</title>
        <link href="css/idGeneratedStyles.css" rel="stylesheet" type="text/css" />
    </head>
    <body id="the-title-3" lang="en-GB" xml:lang="en-GB" style="width:1332px;height:794px">
        <div id="_idContainer003">
            <img class="_idGenObjectAttribute-1 _idGenObjectAttribute-2" src="image/inner_cover_and_credits_page.jpg" alt="" />
        </div>
        <div id="_idContainer004">
            <div style="width:11599.37px;height:2993.39px;position:absolute;top:0px;left:0px;-webkit-transform-origin: 0% 0%; -webkit-transform: translate(0px,3.93px) rotate(0deg) scale(0.05);transform-origin: 0% 0%; transform: translate(0px,3.93px) rotate(0deg) scale(0.05);">
                <p class="Basic-Paragraph ParaOverride-1"><span id="_idTextSpan000" class="CharOverride-1" style="position:absolute;top:13.65px;left:3168.24px;">الجملة الرئيسية في النص </span></p>
                <p class="Basic-Paragraph ParaOverride-1"><span id="_idTextSpan001" class="CharOverride-1" style="position:absolute;top:733.65px;left:831.71px;">&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;الكاتبة</span></p>
            </div>
        </div>
    </body>
</html>

这是它对应的css文件:

And this is it's corresponding css file:

@font-face {
    font-family:"Futura Lt BT";
    font-style:normal;
    font-weight:normal;
    src : url("../font/FuturaBT-Light.TTF") format('truetype');
}
@font-face {
    font-family:"GE SS Text Light";
    font-style:normal;
    font-weight:300;
    src : url("../font/GESSTextLight-Light.otf") format('opentype');
}
@font-face {
    font-family:"GE SS Text Medium";
    font-style:normal;
    font-weight:500;
    src : url("../font/GESSTextMedium-Medium.otf") format('opentype');
}
@font-face {
    font-family:"Simplified Arabic";
    font-style:normal;
    font-weight:bold;
    src : url("../font/SimplifiedArabic-Bold.ttf") format('truetype');
}

body, div, dl, dt, dd, h1, h2, h3, h4, h5, h6, p, pre, code, blockquote         {
    margin:0;
    padding:0;
    border-width:0;
    text-rendering:optimizeSpeed;
}
div.Basic-Text-Frame {
    border-style:solid;
}
p.ParaOverride-1 {
    line-height:1;
    white-space:nowrap;
}
span.CharOverride-1 {
    color:#000000;
    font-family:"GE SS Text Medium", sans-serif;
    font-size:420px;
    font-style:normal;
    font-weight:500;
}

这是文件布局的截图:

在 UIWebView 中加载 html 的内容:

To load the content of the html in the UIWebView:

[readingWebView loadHTMLString:contents baseURL:baseURL];

我在其他阅读器上提交的文件与我在应用程序中使用的文件之间的唯一区别是,我向其他阅读器(如 iBooks)提交格式为 .epub 的文件,而我在我的应用程序中使用扩展名为 .zip 的相同文件.但我不确定这是否相关.为了在 epub 中显示 html 文件的内容,我使用 UIWebView.

The only difference I can find between the submitted file on the other reader and the one I use in my application is that I submit a file of format .epub to the other reader like iBooks while I use the same file with extension .zip on my application. But I'm not sure if this is related. To display the content of the html files in the epub I use the UIWebView.

推荐答案

并非所有字体都适合网页显示.你可以在这里检查你的字体.请注意,有些字体具有网络、屏幕或移动设备的活动图标,而有些则没有.同时使用那些为网页和屏幕设计的字体.https://www.fontsquirrel.com/fonts/list/recent

Not all the fonts are suitable for web display. You can check your font here. Notice, that some fonts have active icons of web, screen or mobile, and some don't. Use those fonts which are designed for web and screen simultaneously. https://www.fontsquirrel.com/fonts/list/recent

这篇关于电子书阅读器未捕获 epub 文件的嵌入字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆