P 标签在 iBooks 2.0.1 中无法正确呈现

发布于 2025-01-03 23:25:51 字数 1523 浏览 0 评论 0原文

我有一个使用 InDesign 5.5 创建的 EPUB,并尝试在 iPad 上使用内置的 Futura。 H1 和 H2 标签在 iBooks 2.0.1 中正确呈现,但 P 标签和类默认为 Times Roman。我尝试过 samp hack,但没有成功。这是一个例子:

p.Narrative-Body {
font-family : Futura, Arial, sans-serif;
font-weight : normal;
font-style : normal;
font-size : 1em;
font-variant : normal;
line-height : 1.6;
text-align : left;
color : #000000; }

这是 html:

<p class="Narrative-Body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sapien lorem, semper ac tempus quis, imperdiet quis dui. Morbi sed sollicitudin elit.</p> *Real copy covered by non-disclosure.*

在电子制作网站上找不到任何答案,我重新安装了 iBooks。同样的问题。但是,它在 ADE 和 Safari 中正常工作,并且 Calibre 正确显示无衬线字体。 提前致谢!


我们正在进步!!我添加了 com.apple xml 文件并将我的正文样式映射到 p 标签。现在,它们显示 Futura,但前提是它们是直接的 p 标签或带有跨度的 p 标签(用于插入文本)。带类的 P 标签仍然不使用 Futura。作为一个测试,我在 html 和 css 中将类名设置为小写,但仍然没有成功。这是修改后的 HTML:

<p><span class="Quote-RunIn">“Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci.” </p>

CSS 现在是:

p {
font-family: Futura, Arial, sans-serif;
font-weight: normal;
font-style: normal;
font-size: 1em;
font-variant: normal;
line-height: 1.6;
text-align: left;
margin: 0 0 1em 0;
orphans: 2;
widows: 2;

}

Natasha,因为我没有使用 samp 标签,所以我应该在 p 标签中指定 font-family,对吧?

I have an EPUB created with InDesign 5.5 and am trying to use the built-in Futura on the iPad. H1 and H2 tags render properly in iBooks 2.0.1 but P tag and classes default to Times Roman. I've tried the samp hack, but no luck. Here's an example:

p.Narrative-Body {
font-family : Futura, Arial, sans-serif;
font-weight : normal;
font-style : normal;
font-size : 1em;
font-variant : normal;
line-height : 1.6;
text-align : left;
color : #000000; }

and here's the html:

<p class="Narrative-Body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sapien lorem, semper ac tempus quis, imperdiet quis dui. Morbi sed sollicitudin elit.</p> *Real copy covered by non-disclosure.*

Couldn't find any answers on the e-production sites and I re-installed iBooks. Same problem. However, it works properly in ADE and Safari and Calibre correctly shows sans-serif.
Thanks in advance!


We're making progress!! I added the com.apple xml file and mapped my body style to p tags. Now they display Futura, but only if they're straight p tags or p tags with spans (used for run-in text). P tags w/classes still don't use Futura. Just as a test, I made the class names lowercase in the html and css, but still no luck. Here's the revised HTML:

<p><span class="Quote-RunIn">“Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci.” </p>

The CSS is now:

p {
font-family: Futura, Arial, sans-serif;
font-weight: normal;
font-style: normal;
font-size: 1em;
font-variant: normal;
line-height: 1.6;
text-align: left;
margin: 0 0 1em 0;
orphans: 2;
widows: 2;

}

Natasha, since I'm not using the samp tag, I should specify the font-family in the p tag, right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

李不 2025-01-10 23:25:51

您的 META-INF 中是否有 com.apple.ibooks.display-options.xml 文件?它应该包含:

<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
</platform>
</display_options>

这可能只是嵌入字体所必需的;我忘记了。对不起,哈哈!让我知道这是否适合您!


这是正确的。 font-family 在 p 标签内不起作用,但它在 h 标签内起作用。您想取出 p 标签中的 font-family 。执行此操作:

p.Narrative-Body {
font-weight : normal;
font-style : normal;
font-size : 1em;
font-variant : normal;
line-height : 1.6;
text-align : left;
color : #000000; }
samp { font-family : Futura, Arial, sans-serif; }

标记应为:

<p class="Narrative-Body"><samp>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sapien lorem, semper ac tempus quis, imperdiet quis dui. Morbi sed sollicitudin elit.</samp></p>

请注意,您还需要我之前在 META-INF 文件夹中提到的文件。

这绝对有效;如果您发现没有,那么也许可以运行 CSS 和标记验证器,看看是否有其他东西干扰?

祝你好运!

Do you have the com.apple.ibooks.display-options.xml file in your META-INF? It should have in it:

<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
</platform>
</display_options>

This might just be necessary for embedded fonts; I forget. I'm sorry, LOL! Let me know if that works for you!


That's right. The font-family doesn't work inside the p tag, although it works inside the h tags. You want to take out the font-family in the p tag. Do this:

p.Narrative-Body {
font-weight : normal;
font-style : normal;
font-size : 1em;
font-variant : normal;
line-height : 1.6;
text-align : left;
color : #000000; }
samp { font-family : Futura, Arial, sans-serif; }

The the markup should be:

<p class="Narrative-Body"><samp>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sapien lorem, semper ac tempus quis, imperdiet quis dui. Morbi sed sollicitudin elit.</samp></p>

Please note that you will also need the file I mentioned before in your META-INF folder.

This definitely works; if you find it doesn't, then maybe run through CSS and Markup validators, and see if there's something else interfering?

Good luck!

与酒说心事 2025-01-10 23:25:51

您肯定需要 META-INF 中的 Apple Display Options 文件并指定-fonts=true。此设置适用于所有指定的字体 - 嵌入式字体和系统字体。

p { font-family: Futura;} 是很好的语法 - 它可以在 iBooks 中使用。

如果您可以访问 iOS 模拟器,请将您的 XHTML 文件拖到模拟器中的 Safari 中并在那里进行测试 - 有时它对大小写等更加挑剔。也就是说,大写的类不是问题。

祝你好运!

You definitely need the Apple Display Options file in your META-INF with specified-fonts=true. This setting is for all specified fonts - both embedded and system.

p { font-family: Futura;} is fine syntax - it will work in iBooks.

If you have access to the iOS simulator, drag your XHTML file into Safari in the simulator and test there - its sometimes pickier about capitalization, etc. That said, the capitalized class is not a problem.

Good luck!

独孤求败 2025-01-10 23:25:51

嗯,我已经成功了,谢谢大家的帮助。添加 Apple Display Options 文件就可以了。我希望 Adob​​e 在未来的更新中找到一种自动生成此文件的方法。我最终将 font-family 属性保留在 p 标记中,因为这就是 InDesign 生成它的方式。我想,既然它有效,为什么还要诱惑命运呢?

顺便说一句,iBooks 似乎在最新版本中支持 img 宽度标签。

Well, I got it to work, thanks to all of you for your help. Adding the Apple Display Options file did the trick. I hope Adobe finds a way to generate this file automatically in future updates. I wound up leaving the font-family property in the p tag because that's how InDesign generated it. Since it was working, I figured, why tempt fate??

BTW, iBooks seems to honor img width tags in the latest version.

世界和平 2025-01-10 23:25:51

德里克·舒尔茨 (Derrick Schultz) 在 Twitter 上@dvsch 说道:

无法与 ePub 对话,但在 HTML 中无法验证,因为类需要以小写字母开头。

says Derrick Schultz, @dvsch on twitter:

Can't speak to ePub, but in HTML that wouldn't validate because classes need to start w/ lowercase letters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文