lib/softcover/builders/epub.rb in softcover-0.9.21 vs lib/softcover/builders/epub.rb in softcover-0.9.22

- old
+ new

@@ -12,10 +12,11 @@ end remove_html create_directories write_mimetype write_container_xml + write_ibooks_xml write_toc write_nav copy_image_files write_html(options) write_contents @@ -53,10 +54,18 @@ # This is required by the EPUB standard. def write_container_xml File.write(path('epub/META-INF/container.xml'), container_xml) end + # Writes iBooks-specific XML. + # This allows proper display of monospace fonts in code samples, among + # other things. + def write_ibooks_xml + xml_filename = 'com.apple.ibooks.display-options.xml' + File.write(path("epub/META-INF/#{xml_filename}"), ibooks_xml) + end + # Writes the content.opf file. # This is required by the EPUB standard. def write_contents File.write(path('epub/OEBPS/content.opf'), content_opf) end @@ -300,9 +309,18 @@ <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> <rootfiles> <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/> </rootfiles> </container>) + end + + def ibooks_xml +%(<?xml version="1.0" encoding="UTF-8"?> +<display_options> + <platform name="*"> + <option name="specified-fonts">true</option> + </platform> +</display_options>) end # Returns the content configuration file. def content_opf title = manifest.title \ No newline at end of file