docbook-apps

  • 1.  docbook + svg + epub3 -- how to do?

    Posted 03-05-2014 10:17
    Hi, there, I am working on an ebook where I want to use svg for images. I
    see that SVG support in Kindle has improved recently, and plus my images
    might future-proof better if I use svg.

    I suspect that svg and docbook play well together. But I don't know really
    what's going on. I see that there's an example of svg inside an imagedata
    element here: http://docbook.org/tdg51/en/html/_any.svg.html

    How would the epub3 stylesheets render the example (generally I mean). Does
    it just pass the svg code as is into the xhtml?

    Is there any way to do a fallback rendering if the browser or tablet
    doesn't support svg?

    Also, if I use the example below as my svg, when you run the epub3 XSLT,
    which of these files (if any) will appear in package.opf file?

    Robert Nagle


    preserveAspectRatio="xMidYMin meet">
    <defs>
    <desc>
    Chapter 1
    </desc>
    <clipPath id="inset-ch1">
    <use xlink:href="images/ChapterBorder.svg#inset-border"/>
    </clipPath>
    <defs>

    <image xlink:href="images/Ch1.jpeg"
    x="350" y="100" width="300" height="200"
    clip-path = "url(#inset-ch1)" />

    <use xlink:href="images/ChapterBorder.svg"
    x="0" y="0" width="1000" height="500" />

    <text x="500" y="400" text-anchor="middle" font-size="60">
    The Lamp in the Window
    </text>








    --
    Robert Nagle
    6121 Winsome Ln #56C, Houston TX 77057-5581
    (H) 713 893 3424/ (W) 832-251-7522 Carbon Neutral Since Jan 2010
    http://www.robertnagle.info



  • 2.  Re: [docbook-apps] docbook + svg + epub3 -- how to do?

    Posted 03-05-2014 17:45
    Hi Robert,
    SVG is supported pretty well in the epub3 stylesheet.

    While you can put SVG code inside an imagedata element, most people keep
    the SVG in a separate file and reference the file with a fileref
    attribute on the imagedata. If you use a fileref, the epub3 stylesheet
    will do the following:

    1. Output an XHTML element whose src attribute references the svg
    filename.

    2. For each svg image found in the document, it will add an <item>
    element to the .opf metadata file.

    3. It will add a properties="svg" attribute to the <item> element in
    the .opf file for the XHTML output file containing the svg.

    As with other image files, the stylesheet will not copy the svg file to
    the output directory. Most people use a Makefile or Ant task for that
    purpose.

    The stylesheet does not open any SVG code and investigate it for
    embedded image files.

    There currently is no support for a fallback mechanism for browsers that
    don't support svg. In DocBook 5.1 (forthcoming), there will be support
    for multiple imagedata elements inside an imageobject, which would allow
    you to specify a backup image that the stylesheet could reference.

    Hope this helps.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 3/5/2014 2:17 AM, Robert Nagle wrote:
    > Hi, there, I am working on an ebook where I want to use svg for images. I
    > see that SVG support in Kindle has improved recently, and plus my images
    > might future-proof better if I use svg.
    >
    > I suspect that svg and docbook play well together. But I don't know really
    > what's going on. I see that there's an example of svg inside an imagedata
    > element here: http://docbook.org/tdg51/en/html/_any.svg.html
    >
    > How would the epub3 stylesheets render the example (generally I mean). Does
    > it just pass the svg code as is into the xhtml?
    >
    > Is there any way to do a fallback rendering if the browser or tablet
    > doesn't support svg?
    >
    > Also, if I use the example below as my svg, when you run the epub3 XSLT,
    > which of these files (if any) will appear in package.opf file?
    >
    > Robert Nagle
    >
    >
    > > preserveAspectRatio="xMidYMin meet">
    > <defs>
    > <desc>
    > Chapter 1
    > </desc>
    > <clipPath id="inset-ch1">
    > <use xlink:href="images/ChapterBorder.svg#inset-border"/>
    > </clipPath>
    > <defs>
    >
    > <image xlink:href="images/Ch1.jpeg"
    > x="350" y="100" width="300" height="200"
    > clip-path = "url(#inset-ch1)" />
    >
    > <use xlink:href="images/ChapterBorder.svg"
    > x="0" y="0" width="1000" height="500" />
    >
    > <text x="500" y="400" text-anchor="middle" font-size="60">
    > The Lamp in the Window
    > </text>
    >
    >
    >
    >
    >
    >
    >
    >



  • 3.  Re: [docbook-apps] docbook + svg + epub3 -- how to do?

    Posted 03-05-2014 20:48
    Thanks, Bob for the clarification.

    The image I am trying to use consists of an svg file and an embedded jpg.
    I assume that if I manually made <item> entries for the 8 or 9 embedded
    .jpg images inside the .opf file
    , it would still pass epubcheck. (Based on my reading of the recently
    revised Kindle Formatting Guide, it should render properly on Kindle
    devices and I suspect, ibooks).

    Robert Nagle


    On Wed, Mar 5, 2014 at 11:44 AM, Bob Stayton <bobs@sagehill.net> wrote:

    > Hi Robert,
    > SVG is supported pretty well in the epub3 stylesheet.
    >
    > While you can put SVG code inside an imagedata element, most people keep
    > the SVG in a separate file and reference the file with a fileref attribute
    > on the imagedata. If you use a fileref, the epub3 stylesheet will do the
    > following:
    >
    > 1. Output an XHTML element whose src attribute references the svg
    > filename.
    >
    > 2. For each svg image found in the document, it will add an <item>
    > element to the .opf metadata file.
    >
    > 3. It will add a properties="svg" attribute to the <item> element in the
    > .opf file for the XHTML output file containing the svg.
    >
    > As with other image files, the stylesheet will not copy the svg file to
    > the output directory. Most people use a Makefile or Ant task for that
    > purpose.
    >
    > The stylesheet does not open any SVG code and investigate it for embedded
    > image files.
    >
    > There currently is no support for a fallback mechanism for browsers that
    > don't support svg. In DocBook 5.1 (forthcoming), there will be support for
    > multiple imagedata elements inside an imageobject, which would allow you to
    > specify a backup image that the stylesheet could reference.
    >
    > Hope this helps.
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    >
    > On 3/5/2014 2:17 AM, Robert Nagle wrote:
    >
    >> Hi, there, I am working on an ebook where I want to use svg for images. I
    >> see that SVG support in Kindle has improved recently, and plus my images
    >> might future-proof better if I use svg.
    >>
    >> I suspect that svg and docbook play well together. But I don't know
    >> really
    >> what's going on. I see that there's an example of svg inside an imagedata
    >> element here: http://docbook.org/tdg51/en/html/_any.svg.html
    >>
    >> How would the epub3 stylesheets render the example (generally I mean).
    >> Does
    >> it just pass the svg code as is into the xhtml?
    >>
    >> Is there any way to do a fallback rendering if the browser or tablet
    >> doesn't support svg?
    >>
    >> Also, if I use the example below as my svg, when you run the epub3 XSLT,
    >> which of these files (if any) will appear in package.opf file?
    >>
    >> Robert Nagle
    >>
    >>
    >> >> preserveAspectRatio="xMidYMin meet">
    >> <defs>
    >> <desc>
    >> Chapter 1
    >> </desc>
    >> <clipPath id="inset-ch1">
    >> <use xlink:href="images/ChapterBorder.svg#inset-border"/>
    >> </clipPath>
    >> <defs>
    >>
    >> <image xlink:href="images/Ch1.jpeg"
    >> x="350" y="100" width="300" height="200"
    >> clip-path = "url(#inset-ch1)" />
    >>
    >> <use xlink:href="images/ChapterBorder.svg"
    >> x="0" y="0" width="1000" height="500" />
    >>
    >> <text x="500" y="400" text-anchor="middle" font-size="60">
    >> The Lamp in the Window
    >> </text>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>


    --
    Robert Nagle
    6121 Winsome Ln #56C, Houston TX 77057-5581
    (H) 713 893 3424/ (W) 832-251-7522 Carbon Neutral Since Jan 2010
    http://www.robertnagle.info



  • 4.  Re: [docbook-apps] docbook + svg + epub3 -- how to do?

    Posted 03-05-2014 21:03
    Regarding manually embedding <item> entries, you can automate that
    somewhat. There is an empty placeholder template in the epub3
    stylesheet named 'user.manifest.items'. If that template is customized
    to generate <item> elements in the correct namespace, then they are
    included in the .opf file inside the <manifest> element.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 3/5/2014 12:47 PM, Robert Nagle wrote:
    > Thanks, Bob for the clarification.
    >
    > The image I am trying to use consists of an svg file and an embedded jpg.
    > I assume that if I manually made <item> entries for the 8 or 9 embedded
    > .jpg images inside the .opf file
    > , it would still pass epubcheck. (Based on my reading of the recently
    > revised Kindle Formatting Guide, it should render properly on Kindle
    > devices and I suspect, ibooks).
    >
    > Robert Nagle
    >
    >
    > On Wed, Mar 5, 2014 at 11:44 AM, Bob Stayton <bobs@sagehill.net> wrote:
    >
    >> Hi Robert,
    >> SVG is supported pretty well in the epub3 stylesheet.
    >>
    >> While you can put SVG code inside an imagedata element, most people keep
    >> the SVG in a separate file and reference the file with a fileref attribute
    >> on the imagedata. If you use a fileref, the epub3 stylesheet will do the
    >> following:
    >>
    >> 1. Output an XHTML element whose src attribute references the svg
    >> filename.
    >>
    >> 2. For each svg image found in the document, it will add an <item>
    >> element to the .opf metadata file.
    >>
    >> 3. It will add a properties="svg" attribute to the <item> element in the
    >> .opf file for the XHTML output file containing the svg.
    >>
    >> As with other image files, the stylesheet will not copy the svg file to
    >> the output directory. Most people use a Makefile or Ant task for that
    >> purpose.
    >>
    >> The stylesheet does not open any SVG code and investigate it for embedded
    >> image files.
    >>
    >> There currently is no support for a fallback mechanism for browsers that
    >> don't support svg. In DocBook 5.1 (forthcoming), there will be support for
    >> multiple imagedata elements inside an imageobject, which would allow you to
    >> specify a backup image that the stylesheet could reference.
    >>
    >> Hope this helps.
    >>
    >> Bob Stayton
    >> Sagehill Enterprises
    >> bobs@sagehill.net
    >>
    >>
    >> On 3/5/2014 2:17 AM, Robert Nagle wrote:
    >>
    >>> Hi, there, I am working on an ebook where I want to use svg for images. I
    >>> see that SVG support in Kindle has improved recently, and plus my images
    >>> might future-proof better if I use svg.
    >>>
    >>> I suspect that svg and docbook play well together. But I don't know
    >>> really
    >>> what's going on. I see that there's an example of svg inside an imagedata
    >>> element here: http://docbook.org/tdg51/en/html/_any.svg.html
    >>>
    >>> How would the epub3 stylesheets render the example (generally I mean).
    >>> Does
    >>> it just pass the svg code as is into the xhtml?
    >>>
    >>> Is there any way to do a fallback rendering if the browser or tablet
    >>> doesn't support svg?
    >>>
    >>> Also, if I use the example below as my svg, when you run the epub3 XSLT,
    >>> which of these files (if any) will appear in package.opf file?
    >>>
    >>> Robert Nagle
    >>>
    >>>
    >>> >>> preserveAspectRatio="xMidYMin meet">
    >>> <defs>
    >>> <desc>
    >>> Chapter 1
    >>> </desc>
    >>> <clipPath id="inset-ch1">
    >>> <use xlink:href="images/ChapterBorder.svg#inset-border"/>
    >>> </clipPath>
    >>> <defs>
    >>>
    >>> <image xlink:href="images/Ch1.jpeg"
    >>> x="350" y="100" width="300" height="200"
    >>> clip-path = "url(#inset-ch1)" />
    >>>
    >>> <use xlink:href="images/ChapterBorder.svg"
    >>> x="0" y="0" width="1000" height="500" />
    >>>
    >>> <text x="500" y="400" text-anchor="middle" font-size="60">
    >>> The Lamp in the Window
    >>> </text>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >
    >