wolfgangw / backports

Deep inspection of digital cinema packages
27 stars 12 forks source link

DCSubtitles: allow string content in LoadFont element #58

Closed matmat closed 10 months ago

matmat commented 9 years ago

The spec says "The LoadFont element has only attributes, and no values, so it can be specified as an empty tag (...)". So it seems that this is not required.

Today I encountered an DCSubtitle file with the following:

<LoadFont Id="theFont" URI="arial.ttf">       </LoadFont>

dcp_inspect throws the following error:

Error: DCSubtitle 5842e25b-8eba-4c52-94df-d78a422049c7: Schema check: 
DCSubtitle.v1.mattsson.xsd /dcp/GFF2015-TEMP/HARLIES-COUNTRY_FTR_S_EN-EN-CCAP_AU_51-HI-VI_2K_20131213_DAU_IOP_OV/5842e25b-8eba-4c52-94df-d78a422049c7/CharliesCountry_DCP_Reel1.xml line 1: Element 'LoadFont': Character content is not allowed, because the content type is empty.

And in fact the example on page 31 of http://www.dlp.com/downloads/pdf_dlp_cinema_cinecanvas_rev_c.pdf contains the similar:

<LoadFont Id="theFont" URI="/Font/Helvetica.ttf"> </LoadFont>

So this does indeed seem legit.

The following patch allows for a xs:string as content of the LoadFont element. Also tested successfully on DCSubtitle files with empty LoadFont elements.

--- backports/xsd/DCSubtitle.v1.mattsson.xsd    2015-01-06 14:51:38.073092178 +0100
+++ /usr/local/bin/xsd/DCSubtitle.v1.mattsson.xsd   2015-01-06 14:46:19.947184331 +0100
@@ -23,8 +23,12 @@
   </xs:element>
   <xs:element name="LoadFont">
     <xs:complexType>
-      <xs:attribute name="Id" use="required" type="xs:string"/>
-      <xs:attribute name="URI" use="required" type="xs:anyURI"/>
+      <xs:simpleContent>
+        <xs:extension base="xs:string">
+          <xs:attribute name="Id" use="required" type="xs:string"/>
+          <xs:attribute name="URI" use="required" type="xs:anyURI"/>
+        </xs:extension>
+      </xs:simpleContent>
     </xs:complexType>
   </xs:element>
   <xs:element name="Font">
wolfgangw commented 7 years ago

TI's spec document has this, though, in A.1 DTD Specification:

<!ELEMENT LoadFont EMPTY>

If I read it correctly the prose in 2.7 LoadFont differs from Chapter 3's example differs from A.1 DTD.

Feeling hesitant to take xs:simpleContent on board ... convince me? [ducks]

matmat commented 10 months ago

@wolfgangw You are right. Feel free to close this. The example DCP I was referencing is clearly doing it wrong.

wolfgangw commented 10 months ago

@matmat yes, I agree.

Fwiw, I'm not aware of systems in the field which would choke over content in LoadFont, though. But, I reckon, we have to stick to the ground truth as best as we can.

I will modify the language around Error/Hint/Info (there's a wiki page with a chapter on the distinction) to mention that Error may merely be a violation of a given standard, with no practical consequences in the field. Right now, it says that Error will result in playback failure, iirc. (it's ok, kind of had that already)