Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed layout SVG dimensions can also be obtained from height/width attributes #902

Closed
mattgarrish opened this issue Nov 12, 2018 · 1 comment
Assignees
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: has PR The issue is being processed in a pull request
Milestone

Comments

@mattgarrish
Copy link
Member

Prior to 3.2, the dimensions had to be set in the viewBox attribute, but now it's valid to specify the dimension in height/width attributes on the svg root element. It's also valid to specify both the viewBox and height/width.

If only height/width are set, there should be a warning to use viewBox, as the specification contains a recommendation to only use it.

Reference: https://w3c.github.io/publ-epub-revision/epub32/spec/epub-contentdocs.html#sec-fxl-icb-svg

@mattgarrish mattgarrish added spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: accepted Ready to be further processed labels Nov 12, 2018
@rdeltour rdeltour added this to the 4.2.0-beta milestone Feb 4, 2019
@rdeltour rdeltour added status: has PR The issue is being processed in a pull request and removed status: accepted Ready to be further processed labels Feb 22, 2019
@rdeltour
Copy link
Member

So the spec says:

If only the x, y, height and width attributes are present, they SHOULD be defined in pixel values (establishing the ICB). Note that if the pixel values defined by x, y, height and width attributes exceed the Viewport's pixel values, the graphic will be clipped on the Viewport boundaries (i.e., the graphics will not be rescaled).

I'm wondering why other absolute length values are not allowed, is this a shortcoming of the spec or was it actually intended to limit it to pixel values?

Also, I'm no SVG expert but wouldn't it suffice to require width and height to be set in absolute lengths? Wouldn't percentage-valued x and y be resolved in the coordinate system created by width and height?

rdeltour pushed a commit that referenced this issue Feb 23, 2019
This change implements the new rules related to expressing the initial
containing block dimensions for SVG documents in Fixed Layout EPUBs.

New messages:

- `HTM-054` (`WARNING`): when the size is given by `width`/`height`
  attributes, but the recommended `viewBox` attribute is missing
- `HTM-055` (`WARNING`): when the values of the `height` and `width`
  attributes are not specified in pixels, and `viewBox` is not present

Changed message:

- `HTM-048` (`ERROR`): now says that either `viewBox` or `height` and
  `width` must be present

Bug fix:

- Only the outer SVG element is checked (previously, all the `svg`
  elements where checked).

Fix #902.

Note: the checking logic may need to be tweaked depending on the outcome
of issue w3c/epub-specs#1236
rdeltour pushed a commit that referenced this issue Feb 23, 2019
This change implements the new rules related to expressing the initial
containing block dimensions for SVG documents in Fixed Layout EPUBs.

New messages:

- `HTM-054` (`WARNING`): when the size is given by `width`/`height`
  attributes, but the recommended `viewBox` attribute is missing
- `HTM-055` (`WARNING`): when the values of the `height` and `width`
  attributes are not specified in pixels, and `viewBox` is not present

Changed message:

- `HTM-048` (`ERROR`): now says that either `viewBox` or `height` and
  `width` must be present

Bug fix:

- Only the outer SVG element is checked (previously, all the `svg`
  elements where checked).

Fix #902.

Note: the checking logic may need to be tweaked depending on the outcome
of issue w3c/epub-specs#1236
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: has PR The issue is being processed in a pull request
Projects
None yet
Development

No branches or pull requests

3 participants