emf 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +224 -19
  3. data/exe/emf +12 -0
  4. data/lib/emf/backend.rb +60 -0
  5. data/lib/emf/binary/class_field_accessors.rb +49 -0
  6. data/lib/emf/binary/float32_le.rb +54 -0
  7. data/lib/emf/binary/types.rb +40 -6
  8. data/lib/emf/conformance/context.rb +36 -0
  9. data/lib/emf/conformance/diagnostic.rb +18 -0
  10. data/lib/emf/conformance/manifest/emf_bitmap_misc.yml +622 -0
  11. data/lib/emf/conformance/manifest/emf_control_buffers.yml +61 -0
  12. data/lib/emf/conformance/manifest/emf_core.yml +117 -0
  13. data/lib/emf/conformance/manifest/emf_corpus_rules.yml +21 -0
  14. data/lib/emf/conformance/manifest/emf_objects_geometry.yml +229 -0
  15. data/lib/emf/conformance/manifest/emf_plus.yml +357 -0
  16. data/lib/emf/conformance/manifest/emf_plus_core.yml +33 -0
  17. data/lib/emf/conformance/manifest/emf_state_path.yml +403 -0
  18. data/lib/emf/conformance/manifest/emf_text.yml +97 -0
  19. data/lib/emf/conformance/manifest/wmf.yml +874 -0
  20. data/lib/emf/conformance/manifest.rb +79 -0
  21. data/lib/emf/conformance/profile.rb +35 -0
  22. data/lib/emf/conformance/record_types.rb +24 -0
  23. data/lib/emf/conformance/registry.rb +76 -0
  24. data/lib/emf/conformance/report.rb +83 -0
  25. data/lib/emf/conformance/rule.rb +16 -0
  26. data/lib/emf/conformance/rules/emf_bitmap.rb +357 -0
  27. data/lib/emf/conformance/rules/emf_comment_escape.rb +309 -0
  28. data/lib/emf/conformance/rules/emf_control_buffers.rb +137 -0
  29. data/lib/emf/conformance/rules/emf_corpus_named.rb +83 -0
  30. data/lib/emf/conformance/rules/emf_framing.rb +94 -0
  31. data/lib/emf/conformance/rules/emf_geometry.rb +282 -0
  32. data/lib/emf/conformance/rules/emf_header.rb +114 -0
  33. data/lib/emf/conformance/rules/emf_objects.rb +291 -0
  34. data/lib/emf/conformance/rules/emf_parse_recovery.rb +97 -0
  35. data/lib/emf/conformance/rules/emf_path_clip.rb +165 -0
  36. data/lib/emf/conformance/rules/emf_plus.rb +75 -0
  37. data/lib/emf/conformance/rules/emf_plus_common.rb +58 -0
  38. data/lib/emf/conformance/rules/emf_plus_drawing.rb +78 -0
  39. data/lib/emf/conformance/rules/emf_plus_effects.rb +104 -0
  40. data/lib/emf/conformance/rules/emf_plus_fields.rb +169 -0
  41. data/lib/emf/conformance/rules/emf_plus_fields_b.rb +102 -0
  42. data/lib/emf/conformance/rules/emf_plus_framing.rb +172 -0
  43. data/lib/emf/conformance/rules/emf_plus_objects.rb +97 -0
  44. data/lib/emf/conformance/rules/emf_plus_payloads.rb +320 -0
  45. data/lib/emf/conformance/rules/emf_plus_properties.rb +96 -0
  46. data/lib/emf/conformance/rules/emf_plus_state.rb +77 -0
  47. data/lib/emf/conformance/rules/emf_state.rb +244 -0
  48. data/lib/emf/conformance/rules/emf_text.rb +221 -0
  49. data/lib/emf/conformance/rules/emf_transform.rb +85 -0
  50. data/lib/emf/conformance/rules/wmf_buffers.rb +259 -0
  51. data/lib/emf/conformance/rules/wmf_framing.rb +146 -0
  52. data/lib/emf/conformance/rules/wmf_layout_records.rb +112 -0
  53. data/lib/emf/conformance/rules/wmf_objects.rb +168 -0
  54. data/lib/emf/conformance/rules/wmf_records.rb +191 -0
  55. data/lib/emf/conformance/rules/wmf_rejections.rb +184 -0
  56. data/lib/emf/conformance/runner.rb +61 -0
  57. data/lib/emf/conformance/ternary_raster_operations.rb +52 -0
  58. data/lib/emf/conformance.rb +31 -0
  59. data/lib/emf/emf_plus/effects/blur.rb +24 -0
  60. data/lib/emf/emf_plus/effects/brightness_contrast.rb +22 -0
  61. data/lib/emf/emf_plus/effects/color_balance.rb +24 -0
  62. data/lib/emf/emf_plus/effects/color_curve.rb +24 -0
  63. data/lib/emf/emf_plus/effects/color_lookup_table.rb +26 -0
  64. data/lib/emf/emf_plus/effects/color_matrix.rb +23 -0
  65. data/lib/emf/emf_plus/effects/effect.rb +50 -0
  66. data/lib/emf/emf_plus/effects/hue_saturation_lightness.rb +24 -0
  67. data/lib/emf/emf_plus/effects/levels.rb +24 -0
  68. data/lib/emf/emf_plus/effects/opaque.rb +19 -0
  69. data/lib/emf/emf_plus/effects/red_eye_correction.rb +35 -0
  70. data/lib/emf/emf_plus/effects/sharpen.rb +24 -0
  71. data/lib/emf/emf_plus/effects/tint.rb +22 -0
  72. data/lib/emf/emf_plus/effects.rb +45 -0
  73. data/lib/emf/emf_plus/frame.rb +41 -0
  74. data/lib/emf/emf_plus/links/effect_link.rb +16 -0
  75. data/lib/emf/emf_plus/links/get_dc_span.rb +18 -0
  76. data/lib/emf/emf_plus/links/link_error.rb +15 -0
  77. data/lib/emf/emf_plus/links.rb +77 -0
  78. data/lib/emf/emf_plus/object_chain.rb +108 -0
  79. data/lib/emf/emf_plus/object_table.rb +182 -0
  80. data/lib/emf/emf_plus/objects/brush.rb +296 -0
  81. data/lib/emf/emf_plus/objects/custom_line_cap.rb +106 -0
  82. data/lib/emf/emf_plus/objects/font.rb +47 -0
  83. data/lib/emf/emf_plus/objects/image.rb +68 -0
  84. data/lib/emf/emf_plus/objects/image_attributes.rb +28 -0
  85. data/lib/emf/emf_plus/objects/opaque.rb +19 -0
  86. data/lib/emf/emf_plus/objects/parts.rb +103 -0
  87. data/lib/emf/emf_plus/objects/path.rb +21 -0
  88. data/lib/emf/emf_plus/objects/pen.rb +132 -0
  89. data/lib/emf/emf_plus/objects/region.rb +39 -0
  90. data/lib/emf/emf_plus/objects/string_format.rb +55 -0
  91. data/lib/emf/emf_plus/objects/typed.rb +50 -0
  92. data/lib/emf/emf_plus/objects.rb +46 -0
  93. data/lib/emf/emf_plus/parser.rb +64 -2
  94. data/lib/emf/emf_plus/records/base.rb +107 -0
  95. data/lib/emf/emf_plus/records/begin_container.rb +31 -0
  96. data/lib/emf/emf_plus/records/begin_container_no_params.rb +20 -0
  97. data/lib/emf/emf_plus/records/body.rb +16 -0
  98. data/lib/emf/emf_plus/records/clear.rb +22 -0
  99. data/lib/emf/emf_plus/records/clip_transform_flags.rb +26 -0
  100. data/lib/emf/emf_plus/records/comment.rb +21 -0
  101. data/lib/emf/emf_plus/records/draw_arc.rb +33 -0
  102. data/lib/emf/emf_plus/records/draw_beziers.rb +31 -0
  103. data/lib/emf/emf_plus/records/draw_closed_curve.rb +34 -0
  104. data/lib/emf/emf_plus/records/draw_curve.rb +38 -0
  105. data/lib/emf/emf_plus/records/draw_driver_string.rb +61 -0
  106. data/lib/emf/emf_plus/records/draw_ellipse.rb +28 -0
  107. data/lib/emf/emf_plus/records/draw_image.rb +42 -0
  108. data/lib/emf/emf_plus/records/draw_image_points.rb +62 -0
  109. data/lib/emf/emf_plus/records/draw_lines.rb +34 -0
  110. data/lib/emf/emf_plus/records/draw_path.rb +23 -0
  111. data/lib/emf/emf_plus/records/draw_pie.rb +33 -0
  112. data/lib/emf/emf_plus/records/draw_rects.rb +30 -0
  113. data/lib/emf/emf_plus/records/draw_string.rb +41 -0
  114. data/lib/emf/emf_plus/records/end_container.rb +20 -0
  115. data/lib/emf/emf_plus/records/end_of_file.rb +17 -0
  116. data/lib/emf/emf_plus/records/fill_brush.rb +21 -0
  117. data/lib/emf/emf_plus/records/fill_closed_curve.rb +38 -0
  118. data/lib/emf/emf_plus/records/fill_ellipse.rb +29 -0
  119. data/lib/emf/emf_plus/records/fill_path.rb +23 -0
  120. data/lib/emf/emf_plus/records/fill_pie.rb +34 -0
  121. data/lib/emf/emf_plus/records/fill_polygon.rb +32 -0
  122. data/lib/emf/emf_plus/records/fill_rects.rb +31 -0
  123. data/lib/emf/emf_plus/records/fill_region.rb +23 -0
  124. data/lib/emf/emf_plus/records/get_dc.rb +18 -0
  125. data/lib/emf/emf_plus/records/header.rb +35 -0
  126. data/lib/emf/emf_plus/records/multiply_world_transform.rb +24 -0
  127. data/lib/emf/emf_plus/records/object.rb +32 -0
  128. data/lib/emf/emf_plus/records/offset_clip.rb +24 -0
  129. data/lib/emf/emf_plus/records/primitives/argb.rb +20 -0
  130. data/lib/emf/emf_plus/records/primitives/bitmap.rb +32 -0
  131. data/lib/emf/emf_plus/records/primitives/bitmap_data.rb +21 -0
  132. data/lib/emf/emf_plus/records/primitives/blend_colors.rb +22 -0
  133. data/lib/emf/emf_plus/records/primitives/blend_factors.rb +21 -0
  134. data/lib/emf/emf_plus/records/primitives/bounded_array.rb +38 -0
  135. data/lib/emf/emf_plus/records/primitives/byte_reader.rb +25 -0
  136. data/lib/emf/emf_plus/records/primitives/character_range.rb +20 -0
  137. data/lib/emf/emf_plus/records/primitives/compressed_image.rb +17 -0
  138. data/lib/emf/emf_plus/records/primitives/focus_scale_data.rb +20 -0
  139. data/lib/emf/emf_plus/records/primitives/graphics_version.rb +21 -0
  140. data/lib/emf/emf_plus/records/primitives/language_identifier.rb +22 -0
  141. data/lib/emf/emf_plus/records/primitives/metafile.rb +19 -0
  142. data/lib/emf/emf_plus/records/primitives/palette.rb +21 -0
  143. data/lib/emf/emf_plus/records/primitives/path.rb +89 -0
  144. data/lib/emf/emf_plus/records/primitives/path_point_type.rb +21 -0
  145. data/lib/emf/emf_plus/records/primitives/path_point_type_rle.rb +23 -0
  146. data/lib/emf/emf_plus/records/primitives/point.rb +18 -0
  147. data/lib/emf/emf_plus/records/primitives/point_array.rb +42 -0
  148. data/lib/emf/emf_plus/records/primitives/point_f.rb +19 -0
  149. data/lib/emf/emf_plus/records/primitives/point_r.rb +19 -0
  150. data/lib/emf/emf_plus/records/primitives/rect.rb +20 -0
  151. data/lib/emf/emf_plus/records/primitives/rect_array.rb +24 -0
  152. data/lib/emf/emf_plus/records/primitives/rect_f.rb +21 -0
  153. data/lib/emf/emf_plus/records/primitives/region_node.rb +68 -0
  154. data/lib/emf/emf_plus/records/primitives/region_node_child_nodes.rb +22 -0
  155. data/lib/emf/emf_plus/records/primitives/region_node_path.rb +37 -0
  156. data/lib/emf/emf_plus/records/primitives/relative_coordinate.rb +32 -0
  157. data/lib/emf/emf_plus/records/primitives/string_format_data.rb +23 -0
  158. data/lib/emf/emf_plus/records/primitives/transform_matrix.rb +23 -0
  159. data/lib/emf/emf_plus/records/primitives.rb +41 -0
  160. data/lib/emf/emf_plus/records/reset_clip.rb +17 -0
  161. data/lib/emf/emf_plus/records/reset_world_transform.rb +17 -0
  162. data/lib/emf/emf_plus/records/restore.rb +20 -0
  163. data/lib/emf/emf_plus/records/rotate_world_transform.rb +24 -0
  164. data/lib/emf/emf_plus/records/save.rb +20 -0
  165. data/lib/emf/emf_plus/records/scale_world_transform.rb +26 -0
  166. data/lib/emf/emf_plus/records/serializable_object.rb +32 -0
  167. data/lib/emf/emf_plus/records/set_anti_alias_mode.rb +25 -0
  168. data/lib/emf/emf_plus/records/set_clip_path.rb +20 -0
  169. data/lib/emf/emf_plus/records/set_clip_rect.rb +24 -0
  170. data/lib/emf/emf_plus/records/set_clip_region.rb +20 -0
  171. data/lib/emf/emf_plus/records/set_compositing_mode.rb +21 -0
  172. data/lib/emf/emf_plus/records/set_compositing_quality.rb +21 -0
  173. data/lib/emf/emf_plus/records/set_interpolation_mode.rb +21 -0
  174. data/lib/emf/emf_plus/records/set_page_transform.rb +25 -0
  175. data/lib/emf/emf_plus/records/set_pixel_offset_mode.rb +21 -0
  176. data/lib/emf/emf_plus/records/set_rendering_origin.rb +22 -0
  177. data/lib/emf/emf_plus/records/set_text_contrast.rb +24 -0
  178. data/lib/emf/emf_plus/records/set_text_rendering_hint.rb +21 -0
  179. data/lib/emf/emf_plus/records/set_ts_clip.rb +40 -0
  180. data/lib/emf/emf_plus/records/set_ts_graphics.rb +88 -0
  181. data/lib/emf/emf_plus/records/set_world_transform.rb +22 -0
  182. data/lib/emf/emf_plus/records/shape_flags.rb +23 -0
  183. data/lib/emf/emf_plus/records/translate_world_transform.rb +26 -0
  184. data/lib/emf/emf_plus/records/unknown.rb +20 -0
  185. data/lib/emf/emf_plus/records.rb +107 -0
  186. data/lib/emf/emf_plus/serializer.rb +9 -2
  187. data/lib/emf/emf_plus/stream/conformance.rb +68 -0
  188. data/lib/emf/emf_plus/stream/editor.rb +21 -0
  189. data/lib/emf/emf_plus/stream/emf_gap.rb +20 -0
  190. data/lib/emf/emf_plus/stream/link_index.rb +30 -0
  191. data/lib/emf/emf_plus/stream/rebuild.rb +47 -0
  192. data/lib/emf/emf_plus/stream/record_handle.rb +26 -0
  193. data/lib/emf/emf_plus/stream/segment.rb +70 -0
  194. data/lib/emf/emf_plus/stream.rb +153 -0
  195. data/lib/emf/emf_plus.rb +9 -0
  196. data/lib/emf/emr/binary/dib_header.rb +142 -0
  197. data/lib/emf/emr/binary/ext_text_out_fields.rb +43 -0
  198. data/lib/emf/emr/binary/extended_pen_buffers.rb +23 -0
  199. data/lib/emf/emr/binary/fast_fill.rb +1164 -0
  200. data/lib/emf/emr/binary/font.rb +159 -0
  201. data/lib/emf/emr/binary/lazy_utf16_array.rb +82 -0
  202. data/lib/emf/emr/binary/pack_plan.rb +144 -0
  203. data/lib/emf/emr/binary/pack_plan_check.rb +75 -0
  204. data/lib/emf/emr/binary/pack_plan_exact.rb +130 -0
  205. data/lib/emf/emr/binary/pack_plan_generate.rb +116 -0
  206. data/lib/emf/emr/binary/pack_plan_values.rb +92 -0
  207. data/lib/emf/emr/binary/palette_body.rb +19 -0
  208. data/lib/emf/emr/binary/palette_entry.rb +18 -0
  209. data/lib/emf/emr/binary/record.rb +33 -0
  210. data/lib/emf/emr/binary/records/alpha_blend.rb +43 -0
  211. data/lib/emf/emr/binary/records/angle_arc.rb +2 -2
  212. data/lib/emf/emr/binary/records/bit_blt.rb +14 -0
  213. data/lib/emf/emr/binary/records/color_correct_palette.rb +55 -1
  214. data/lib/emf/emr/binary/records/colormatch_to_target_w.rb +76 -1
  215. data/lib/emf/emr/binary/records/create_colorspace.rb +67 -1
  216. data/lib/emf/emr/binary/records/create_colorspace_w.rb +90 -1
  217. data/lib/emf/emr/binary/records/create_dib_pattern_brush_pt.rb +14 -0
  218. data/lib/emf/emr/binary/records/create_font_indirect_w.rb +6 -2
  219. data/lib/emf/emr/binary/records/create_mono_brush.rb +14 -0
  220. data/lib/emf/emr/binary/records/create_palette.rb +19 -1
  221. data/lib/emf/emr/binary/records/delete_colorspace.rb +22 -1
  222. data/lib/emf/emr/binary/records/draw_escape.rb +45 -1
  223. data/lib/emf/emr/binary/records/ellipse.rb +1 -1
  224. data/lib/emf/emr/binary/records/eof.rb +9 -0
  225. data/lib/emf/emr/binary/records/ext_create_pen.rb +80 -1
  226. data/lib/emf/emr/binary/records/ext_escape.rb +45 -1
  227. data/lib/emf/emr/binary/records/ext_flood_fill.rb +9 -2
  228. data/lib/emf/emr/binary/records/ext_select_clip_rgn.rb +9 -1
  229. data/lib/emf/emr/binary/records/ext_text_out_a.rb +16 -3
  230. data/lib/emf/emr/binary/records/ext_text_out_w.rb +14 -3
  231. data/lib/emf/emr/binary/records/fill_rgn.rb +11 -2
  232. data/lib/emf/emr/binary/records/force_ufi_mapping.rb +38 -1
  233. data/lib/emf/emr/binary/records/frame_rgn.rb +12 -2
  234. data/lib/emf/emr/binary/records/gls_bounded_record.rb +61 -1
  235. data/lib/emf/emr/binary/records/gls_record.rb +42 -1
  236. data/lib/emf/emr/binary/records/gradient_fill.rb +7 -0
  237. data/lib/emf/emr/binary/records/invert_rgn.rb +11 -3
  238. data/lib/emf/emr/binary/records/mask_blt.rb +66 -0
  239. data/lib/emf/emr/binary/records/named_escape.rb +78 -1
  240. data/lib/emf/emr/binary/records/paint_rgn.rb +11 -3
  241. data/lib/emf/emr/binary/records/pixel_format.rb +76 -1
  242. data/lib/emf/emr/binary/records/plg_blt.rb +66 -0
  243. data/lib/emf/emr/binary/records/poly_textout_a.rb +128 -1
  244. data/lib/emf/emr/binary/records/poly_textout_w.rb +128 -1
  245. data/lib/emf/emr/binary/records/raw.rb +3 -0
  246. data/lib/emf/emr/binary/records/realize_palette.rb +1 -0
  247. data/lib/emf/emr/binary/records/rectangle.rb +1 -1
  248. data/lib/emf/emr/binary/records/resize_palette.rb +16 -2
  249. data/lib/emf/emr/binary/records/round_rect.rb +2 -2
  250. data/lib/emf/emr/binary/records/select_palette.rb +1 -0
  251. data/lib/emf/emr/binary/records/set_color_adjustment.rb +136 -0
  252. data/lib/emf/emr/binary/records/set_colorspace.rb +22 -1
  253. data/lib/emf/emr/binary/records/set_dibits_to_device.rb +43 -0
  254. data/lib/emf/emr/binary/records/set_icm_profile_a.rb +71 -1
  255. data/lib/emf/emr/binary/records/set_icm_profile_w.rb +71 -1
  256. data/lib/emf/emr/binary/records/set_linked_ufis.rb +49 -1
  257. data/lib/emf/emr/binary/records/set_miter_limit.rb +1 -1
  258. data/lib/emf/emr/binary/records/set_palette_entries.rb +20 -2
  259. data/lib/emf/emr/binary/records/set_text_justification.rb +8 -2
  260. data/lib/emf/emr/binary/records/small_text_out.rb +55 -4
  261. data/lib/emf/emr/binary/records/stretch_blt.rb +14 -0
  262. data/lib/emf/emr/binary/records/stretch_dibits.rb +14 -0
  263. data/lib/emf/emr/binary/records/transparent_blt.rb +43 -0
  264. data/lib/emf/emr/binary/records.rb +4 -2
  265. data/lib/emf/emr/binary/region_data.rb +33 -0
  266. data/lib/emf/emr/binary/state_record_body.rb +33 -0
  267. data/lib/emf/emr/binary/thin_shell.rb +226 -0
  268. data/lib/emf/emr/binary/value_view/layout.rb +101 -0
  269. data/lib/emf/emr/binary/value_view/reader_source.rb +88 -0
  270. data/lib/emf/emr/binary/value_view.rb +173 -0
  271. data/lib/emf/emr/binary/variable_buffers.rb +87 -0
  272. data/lib/emf/emr/binary.rb +4 -0
  273. data/lib/emf/emr/filled_record.rb +77 -0
  274. data/lib/emf/emr/parser.rb +239 -50
  275. data/lib/emf/emr/serializer.rb +4 -5
  276. data/lib/emf/emr.rb +1 -0
  277. data/lib/emf/error.rb +24 -1
  278. data/lib/emf/model/diagnostic.rb +41 -0
  279. data/lib/emf/model/emr/header.rb +40 -1
  280. data/lib/emf/model/emr/records.rb +142 -6
  281. data/lib/emf/model/emr/wire_values.rb +43 -0
  282. data/lib/emf/model/emr.rb +1 -0
  283. data/lib/emf/model/geometry/color.rb +19 -1
  284. data/lib/emf/model/metafile.rb +22 -2
  285. data/lib/emf/model/wmf/bitmap_records.rb +155 -0
  286. data/lib/emf/model/wmf/brush_records.rb +45 -0
  287. data/lib/emf/model/wmf/dc_escape_records.rb +67 -0
  288. data/lib/emf/model/wmf/font_record.rb +40 -0
  289. data/lib/emf/model/wmf/geometry_records.rb +107 -0
  290. data/lib/emf/model/wmf/header.rb +36 -0
  291. data/lib/emf/model/wmf/object_records.rb +71 -0
  292. data/lib/emf/model/wmf/palette_records.rb +68 -0
  293. data/lib/emf/model/wmf/records.rb +247 -0
  294. data/lib/emf/model/wmf/region_records.rb +112 -0
  295. data/lib/emf/model/wmf/state_records.rb +188 -0
  296. data/lib/emf/model/wmf/text_records.rb +36 -0
  297. data/lib/emf/model/wmf.rb +11 -0
  298. data/lib/emf/model.rb +2 -0
  299. data/lib/emf/native/bitmap_fields.rb +58 -0
  300. data/lib/emf/native/diagnostic_contract.rb +39 -0
  301. data/lib/emf/native/diagnostics.rb +81 -0
  302. data/lib/emf/native/emf_plus_loader.rb +35 -0
  303. data/lib/emf/native/emf_plus_snapshot.rb +96 -0
  304. data/lib/emf/native/emf_plus_source.rb +20 -0
  305. data/lib/emf/native/emf_plus_stream.rb +150 -0
  306. data/lib/emf/native/fields.rb +369 -0
  307. data/lib/emf/native/font_fields.rb +87 -0
  308. data/lib/emf/native/gradient_fields.rb +23 -0
  309. data/lib/emf/native/header.rb +35 -0
  310. data/lib/emf/native/header_errors.rb +30 -0
  311. data/lib/emf/native/hydrator.rb +151 -0
  312. data/lib/emf/native/lazy_wire.rb +100 -0
  313. data/lib/emf/native/legacy_state_fields.rb +22 -0
  314. data/lib/emf/native/library_path.rb +68 -0
  315. data/lib/emf/native/loader.rb +120 -0
  316. data/lib/emf/native/palette_fields.rb +45 -0
  317. data/lib/emf/native/poly_text_fields.rb +116 -0
  318. data/lib/emf/native/resource_failure.rb +28 -0
  319. data/lib/emf/native/small_text_fields.rb +27 -0
  320. data/lib/emf/native/snapshot.rb +102 -0
  321. data/lib/emf/native/wmf_bitmap_fields.rb +58 -0
  322. data/lib/emf/native/wmf_brush_fields.rb +62 -0
  323. data/lib/emf/native/wmf_fields.rb +117 -0
  324. data/lib/emf/native/wmf_hydrator.rb +143 -0
  325. data/lib/emf/native/wmf_loading.rb +49 -0
  326. data/lib/emf/native/wmf_palette_fields.rb +60 -0
  327. data/lib/emf/native/wmf_region_fields.rb +92 -0
  328. data/lib/emf/native/wmf_rejection.rb +84 -0
  329. data/lib/emf/native/wmf_remaining_fields.rb +70 -0
  330. data/lib/emf/native/wmf_snapshot.rb +51 -0
  331. data/lib/emf/native/wmf_text_fields.rb +56 -0
  332. data/lib/emf/native.rb +61 -0
  333. data/lib/emf/parse_evidence.rb +57 -0
  334. data/lib/emf/resource_budget/bitmap.rb +66 -0
  335. data/lib/emf/resource_budget/gradient.rb +30 -0
  336. data/lib/emf/resource_budget/poly_text.rb +85 -0
  337. data/lib/emf/resource_budget.rb +382 -0
  338. data/lib/emf/resource_limits/emf_records.rb +130 -0
  339. data/lib/emf/resource_limits.rb +58 -0
  340. data/lib/emf/version.rb +1 -1
  341. data/lib/emf/visitors/dump.rb +4 -0
  342. data/lib/emf/visitors/stats.rb +6 -5
  343. data/lib/emf/wmf/binary.rb +150 -1
  344. data/lib/emf/wmf/bitmap_codec.rb +118 -0
  345. data/lib/emf/wmf/brush_codec.rb +102 -0
  346. data/lib/emf/wmf/dc_escape_codec.rb +75 -0
  347. data/lib/emf/wmf/dib.rb +187 -0
  348. data/lib/emf/wmf/embedded_emf.rb +137 -0
  349. data/lib/emf/wmf/escape_views.rb +89 -0
  350. data/lib/emf/wmf/evidence.rb +255 -0
  351. data/lib/emf/wmf/geometry_codec.rb +49 -0
  352. data/lib/emf/wmf/palette_codec.rb +85 -0
  353. data/lib/emf/wmf/parser.rb +147 -2
  354. data/lib/emf/wmf/recovery.rb +95 -0
  355. data/lib/emf/wmf/region_codec.rb +151 -0
  356. data/lib/emf/wmf/serializer.rb +164 -2
  357. data/lib/emf/wmf/text_codec.rb +123 -0
  358. data/lib/emf/wmf.rb +7 -0
  359. data/lib/emf.rb +13 -9
  360. metadata +287 -10
@@ -0,0 +1,622 @@
1
+ # W13/W14 manifest rows (issue #37). Implemented rows name a registered rule id.
2
+ - id: emf.bitmap.record_size
3
+ format: emf
4
+ record_types:
5
+ - EMR_ALPHABLEND
6
+ - EMR_BITBLT
7
+ - EMR_MASKBLT
8
+ - EMR_PLGBLT
9
+ - EMR_SETDIBITSTODEVICE
10
+ - EMR_STRETCHBLT
11
+ - EMR_STRETCHDIBITS
12
+ - EMR_TRANSPARENTBLT
13
+ citation: MS-EMF 2.3.1
14
+ status: implemented
15
+ reason:
16
+ - id: emf.bitmap.usage
17
+ format: emf
18
+ record_types:
19
+ - EMR_ALPHABLEND
20
+ - EMR_BITBLT
21
+ - EMR_MASKBLT
22
+ - EMR_PLGBLT
23
+ - EMR_SETDIBITSTODEVICE
24
+ - EMR_STRETCHBLT
25
+ - EMR_STRETCHDIBITS
26
+ - EMR_TRANSPARENTBLT
27
+ citation: MS-EMF 2.1.9
28
+ status: implemented
29
+ reason:
30
+ - id: emf.bitmap.bmi_range
31
+ format: emf
32
+ record_types:
33
+ - EMR_ALPHABLEND
34
+ - EMR_BITBLT
35
+ - EMR_MASKBLT
36
+ - EMR_PLGBLT
37
+ - EMR_SETDIBITSTODEVICE
38
+ - EMR_STRETCHBLT
39
+ - EMR_STRETCHDIBITS
40
+ - EMR_TRANSPARENTBLT
41
+ citation: MS-EMF 2.3.1
42
+ status: implemented
43
+ reason:
44
+ - id: emf.bitmap.bits_range
45
+ format: emf
46
+ record_types:
47
+ - EMR_ALPHABLEND
48
+ - EMR_BITBLT
49
+ - EMR_MASKBLT
50
+ - EMR_PLGBLT
51
+ - EMR_SETDIBITSTODEVICE
52
+ - EMR_STRETCHBLT
53
+ - EMR_STRETCHDIBITS
54
+ - EMR_TRANSPARENTBLT
55
+ citation: MS-EMF 2.3.1
56
+ status: implemented
57
+ reason:
58
+ - id: emf.bitmap.buffer_fixed_overlap
59
+ format: emf
60
+ record_types:
61
+ - EMR_ALPHABLEND
62
+ - EMR_BITBLT
63
+ - EMR_MASKBLT
64
+ - EMR_PLGBLT
65
+ - EMR_SETDIBITSTODEVICE
66
+ - EMR_STRETCHBLT
67
+ - EMR_STRETCHDIBITS
68
+ - EMR_TRANSPARENTBLT
69
+ citation: MS-EMF 2.3.1
70
+ status: implemented
71
+ reason:
72
+ - id: emf.bitmap.buffer_overlap
73
+ format: emf
74
+ record_types:
75
+ - EMR_ALPHABLEND
76
+ - EMR_BITBLT
77
+ - EMR_MASKBLT
78
+ - EMR_PLGBLT
79
+ - EMR_SETDIBITSTODEVICE
80
+ - EMR_STRETCHBLT
81
+ - EMR_STRETCHDIBITS
82
+ - EMR_TRANSPARENTBLT
83
+ citation: MS-EMF 2.3.1
84
+ status: implemented
85
+ reason:
86
+ - id: emf.bitmap.bmi_header_size
87
+ format: emf
88
+ record_types:
89
+ - EMR_ALPHABLEND
90
+ - EMR_BITBLT
91
+ - EMR_MASKBLT
92
+ - EMR_PLGBLT
93
+ - EMR_SETDIBITSTODEVICE
94
+ - EMR_STRETCHBLT
95
+ - EMR_STRETCHDIBITS
96
+ - EMR_TRANSPARENTBLT
97
+ citation: MS-WMF 2.2.2.9
98
+ status: implemented
99
+ reason:
100
+ - id: emf.bitmap.bmi_extent
101
+ format: emf
102
+ record_types:
103
+ - EMR_ALPHABLEND
104
+ - EMR_BITBLT
105
+ - EMR_MASKBLT
106
+ - EMR_PLGBLT
107
+ - EMR_SETDIBITSTODEVICE
108
+ - EMR_STRETCHBLT
109
+ - EMR_STRETCHDIBITS
110
+ - EMR_TRANSPARENTBLT
111
+ citation: MS-WMF 2.2.2.3
112
+ status: implemented
113
+ reason:
114
+ - id: emf.bitmap.bmi_planes
115
+ format: emf
116
+ record_types:
117
+ - EMR_ALPHABLEND
118
+ - EMR_BITBLT
119
+ - EMR_MASKBLT
120
+ - EMR_PLGBLT
121
+ - EMR_SETDIBITSTODEVICE
122
+ - EMR_STRETCHBLT
123
+ - EMR_STRETCHDIBITS
124
+ - EMR_TRANSPARENTBLT
125
+ citation: MS-WMF 2.2.2.3
126
+ status: implemented
127
+ reason:
128
+ - id: emf.bitmap.bmi_bitcount
129
+ format: emf
130
+ record_types:
131
+ - EMR_ALPHABLEND
132
+ - EMR_BITBLT
133
+ - EMR_MASKBLT
134
+ - EMR_PLGBLT
135
+ - EMR_SETDIBITSTODEVICE
136
+ - EMR_STRETCHBLT
137
+ - EMR_STRETCHDIBITS
138
+ - EMR_TRANSPARENTBLT
139
+ citation: MS-WMF 2.1.1.3
140
+ status: implemented
141
+ reason:
142
+ - id: emf.bitmap.bmi_compression
143
+ format: emf
144
+ record_types:
145
+ - EMR_ALPHABLEND
146
+ - EMR_BITBLT
147
+ - EMR_MASKBLT
148
+ - EMR_PLGBLT
149
+ - EMR_SETDIBITSTODEVICE
150
+ - EMR_STRETCHBLT
151
+ - EMR_STRETCHDIBITS
152
+ - EMR_TRANSPARENTBLT
153
+ citation: MS-WMF 2.1.1.7
154
+ status: implemented
155
+ reason:
156
+ - id: emf.bitmap.bits_length
157
+ format: emf
158
+ record_types:
159
+ - EMR_ALPHABLEND
160
+ - EMR_BITBLT
161
+ - EMR_MASKBLT
162
+ - EMR_PLGBLT
163
+ - EMR_SETDIBITSTODEVICE
164
+ - EMR_STRETCHBLT
165
+ - EMR_STRETCHDIBITS
166
+ - EMR_TRANSPARENTBLT
167
+ citation: MS-WMF 2.2.2.9
168
+ status: implemented
169
+ reason:
170
+ - id: emf.bitmap.bmi_v5_intent
171
+ format: emf
172
+ record_types:
173
+ - EMR_ALPHABLEND
174
+ - EMR_BITBLT
175
+ - EMR_MASKBLT
176
+ - EMR_PLGBLT
177
+ - EMR_SETDIBITSTODEVICE
178
+ - EMR_STRETCHBLT
179
+ - EMR_STRETCHDIBITS
180
+ - EMR_TRANSPARENTBLT
181
+ citation: MS-WMF 2.2.2.5
182
+ status: implemented
183
+ reason:
184
+ # A packed DIB whose ColorUsed is nonzero is reported by emf.bitmap.color_table (the same shortfall); this rule then
185
+ # stays silent.
186
+ - id: emf.bitmap.color_table_length
187
+ format: emf
188
+ record_types:
189
+ - EMR_ALPHABLEND
190
+ - EMR_BITBLT
191
+ - EMR_MASKBLT
192
+ - EMR_PLGBLT
193
+ - EMR_SETDIBITSTODEVICE
194
+ - EMR_STRETCHBLT
195
+ - EMR_STRETCHDIBITS
196
+ - EMR_TRANSPARENTBLT
197
+ citation: MS-WMF 2.2.2.9
198
+ status: implemented
199
+ reason:
200
+ - id: emf.bitmap.mask_monochrome
201
+ format: emf
202
+ record_types:
203
+ - EMR_MASKBLT
204
+ - EMR_PLGBLT
205
+ citation: MS-EMF 2.3.1.2
206
+ status: implemented
207
+ reason:
208
+ - id: emf.bitmap.raster_operation
209
+ format: emf
210
+ record_types:
211
+ - EMR_BITBLT
212
+ - EMR_STRETCHBLT
213
+ - EMR_STRETCHDIBITS
214
+ citation: MS-EMF 2.3.1.1
215
+ status: implemented
216
+ reason:
217
+ - id: emf.bitmap.rop4_reserved
218
+ format: emf
219
+ record_types:
220
+ - EMR_MASKBLT
221
+ citation: MS-EMF 2.3.1.2
222
+ status: implemented
223
+ reason:
224
+ - id: emf.bitmap.blend_operation
225
+ format: emf
226
+ record_types:
227
+ - EMR_ALPHABLEND
228
+ citation: MS-EMF 2.3.1.4
229
+ status: implemented
230
+ reason:
231
+ - id: emf.bitmap.alpha_format
232
+ format: emf
233
+ record_types:
234
+ - EMR_ALPHABLEND
235
+ citation: MS-EMF 2.3.1.4
236
+ status: implemented
237
+ reason:
238
+ - id: emf.bitmap.positive_extent
239
+ format: emf
240
+ record_types:
241
+ - EMR_ALPHABLEND
242
+ citation: MS-EMF 2.3.1.4
243
+ status: implemented
244
+ reason:
245
+ - id: emf.comment.padding
246
+ format: emf
247
+ record_types:
248
+ - EMR_COMMENT
249
+ citation: MS-EMF 2.3.3
250
+ status: implemented
251
+ reason:
252
+ - id: emf.comment.header_size
253
+ format: emf
254
+ record_types:
255
+ - EMR_COMMENT
256
+ citation: MS-EMF 2.3.3.4
257
+ status: implemented
258
+ reason:
259
+ - id: emf.comment.public_payload
260
+ format: emf
261
+ record_types:
262
+ - EMR_COMMENT
263
+ citation: MS-EMF 2.3.3.4
264
+ status: implemented
265
+ reason:
266
+ - id: emf.comment.public_identifier
267
+ format: emf
268
+ record_types:
269
+ - EMR_COMMENT
270
+ citation: MS-EMF 2.3.3.4
271
+ status: implemented
272
+ reason:
273
+ - id: emf.comment.windows_metafile_reserved
274
+ format: emf
275
+ record_types:
276
+ - EMR_COMMENT
277
+ citation: MS-EMF 2.3.3.4.4
278
+ status: implemented
279
+ reason:
280
+ - id: emf.comment.group_unclosed
281
+ format: emf
282
+ record_types:
283
+ - EMR_COMMENT
284
+ citation: MS-EMF 2.3.3.4.1
285
+ status: implemented
286
+ reason:
287
+ - id: emf.comment.group_end
288
+ format: emf
289
+ record_types:
290
+ - EMR_COMMENT
291
+ citation: MS-EMF 2.3.3.4.2
292
+ status: implemented
293
+ reason:
294
+ - id: emf.comment.multiformats_eps_version
295
+ format: emf
296
+ record_types:
297
+ - EMR_COMMENT
298
+ citation: MS-EMF 2.2.4
299
+ status: implemented
300
+ reason:
301
+ - id: emf.comment.multiformats_signature
302
+ format: emf
303
+ record_types:
304
+ - EMR_COMMENT
305
+ citation: MS-EMF 2.2.4
306
+ status: implemented
307
+ reason:
308
+ - id: emf.comment.group_description
309
+ format: emf
310
+ record_types:
311
+ - EMR_COMMENT
312
+ citation: MS-EMF 2.3.3.4.1
313
+ status: implemented
314
+ reason:
315
+ - id: emf.escape.record_size
316
+ format: emf
317
+ record_types:
318
+ - EMR_DRAWESCAPE
319
+ - EMR_EXTESCAPE
320
+ - EMR_NAMEDESCAPE
321
+ citation: MS-EMF 2.3.6
322
+ status: implemented
323
+ reason:
324
+ - id: emf.escape.payload_bounds
325
+ format: emf
326
+ record_types:
327
+ - EMR_DRAWESCAPE
328
+ - EMR_EXTESCAPE
329
+ - EMR_NAMEDESCAPE
330
+ citation: MS-EMF 2.3.6
331
+ status: implemented
332
+ reason:
333
+ - id: emf.escape.driver_name
334
+ format: emf
335
+ record_types:
336
+ - EMR_NAMEDESCAPE
337
+ citation: MS-EMF 2.3.6.3
338
+ status: implemented
339
+ reason:
340
+ - id: emf.opengl.record_size
341
+ format: emf
342
+ record_types:
343
+ - EMR_GLSRECORD
344
+ - EMR_GLSBOUNDEDRECORD
345
+ citation: MS-EMF 2.3.9
346
+ status: implemented
347
+ reason:
348
+ - id: emf.opengl.payload_bounds
349
+ format: emf
350
+ record_types:
351
+ - EMR_GLSRECORD
352
+ - EMR_GLSBOUNDEDRECORD
353
+ citation: MS-EMF 2.3.9
354
+ status: implemented
355
+ reason:
356
+ # One diagnostic per defect (W37). A shortfall that a more specific rule also states is left to that rule:
357
+ # EMR_SETCOLORADJUSTMENT emf.state.fixed_size (decoded), emf.record.fixed_size_raw (Raw)
358
+ # EMR_POLYTEXTOUTA / W emf.opaque.text_arrays
359
+ # EMR_SETCOLORSPACE, EMR_COLORCORRECTPALETTE emf.object.fixed_size
360
+ # EMR_SETICMPROFILEA / W, EMR_SETLINKEDUFIS, EMR_COLORMATCHTOTARGETW emf.state.profile_bounds and
361
+ # emf.state.linked_ufis_bounds when the record decodes; this rule sees only a Raw one
362
+ # EMR_PIXELFORMAT, EMR_FORCEUFIMAPPING this rule owns a Size below the layout; emf.state.layout_size owns an
363
+ # oversized one
364
+ - id: emf.opaque.fixed_size
365
+ format: emf
366
+ record_types:
367
+ - EMR_CREATECOLORSPACE
368
+ - EMR_DELETECOLORSPACE
369
+ - EMR_PIXELFORMAT
370
+ - EMR_FORCEUFIMAPPING
371
+ - EMR_SETICMPROFILEA
372
+ - EMR_SETICMPROFILEW
373
+ - EMR_SETLINKEDUFIS
374
+ - EMR_COLORMATCHTOTARGETW
375
+ - EMR_CREATECOLORSPACEW
376
+ citation: MS-EMF 2.3
377
+ status: implemented
378
+ reason:
379
+ # EMR_POLYTEXTOUTA / W are checked by emf.opaque.text_arrays. The ICM profile, linked UFI and color-match records are
380
+ # checked here only when Raw; a decoded one gets emf.state.profile_bounds or emf.state.linked_ufis_bounds.
381
+ - id: emf.opaque.payload_bounds
382
+ format: emf
383
+ record_types:
384
+ - EMR_SETICMPROFILEA
385
+ - EMR_SETICMPROFILEW
386
+ - EMR_SETLINKEDUFIS
387
+ - EMR_COLORMATCHTOTARGETW
388
+ - EMR_CREATECOLORSPACEW
389
+ citation: MS-EMF 2.3
390
+ status: implemented
391
+ reason:
392
+ - id: emf.bitmap.raster_operation_enum
393
+ format: emf
394
+ record_types:
395
+ - EMR_BITBLT
396
+ - EMR_STRETCHBLT
397
+ - EMR_STRETCHDIBITS
398
+ citation: MS-WMF 2.1.1.31
399
+ status: not_checkable
400
+ reason: the TernaryRasterOperation enumeration in the reference text lists 247 distinct
401
+ codes for 256 values, so there is no complete oracle; only the reserved high byte
402
+ is checked
403
+ - id: emf.bitmap.rop4_values
404
+ format: emf
405
+ record_types:
406
+ - EMR_MASKBLT
407
+ citation: MS-EMF 2.3.1.2
408
+ status: not_checkable
409
+ reason: BackgroundROP3/ForegroundROP3 are 8-bit indexes into the same incomplete
410
+ TernaryRasterOperation list
411
+ - id: emf.bitmap.bits_pixels
412
+ format: emf
413
+ record_types:
414
+ - EMR_ALPHABLEND
415
+ - EMR_BITBLT
416
+ - EMR_MASKBLT
417
+ - EMR_PLGBLT
418
+ - EMR_SETDIBITSTODEVICE
419
+ - EMR_STRETCHBLT
420
+ - EMR_STRETCHDIBITS
421
+ - EMR_TRANSPARENTBLT
422
+ citation: MS-WMF 2.2.2.9
423
+ status: deferred
424
+ reason: 'readable through the bits_bytes accessor, not written: the BI_JPEG/BI_PNG
425
+ signature and the RLE stream grammar (MS-WMF 3.1.6) have no MUST that names a
426
+ byte pattern, so a check would be derived from the format specifications [JFIF]/[RFC2083],
427
+ not the reference text'
428
+ - id: emf.bitmap.bmi_extended_header
429
+ format: emf
430
+ record_types:
431
+ - EMR_ALPHABLEND
432
+ - EMR_BITBLT
433
+ - EMR_MASKBLT
434
+ - EMR_PLGBLT
435
+ - EMR_SETDIBITSTODEVICE
436
+ - EMR_STRETCHBLT
437
+ - EMR_STRETCHDIBITS
438
+ - EMR_TRANSPARENTBLT
439
+ citation: MS-WMF 2.2.2.4
440
+ status: deferred
441
+ reason: 'readable through bmi_bytes, not written beyond the V5 Intent (emf.bitmap.bmi_v5_intent):
442
+ BitmapV4/V5 ColorSpaceType against ProfileData/ProfileSize ranges and the linked-profile
443
+ code-page-1252 name state no checkable MUST on the record'
444
+ - id: emf.bitmap.color_table
445
+ format: emf
446
+ record_types:
447
+ - EMR_ALPHABLEND
448
+ - EMR_BITBLT
449
+ - EMR_MASKBLT
450
+ - EMR_PLGBLT
451
+ - EMR_SETDIBITSTODEVICE
452
+ - EMR_STRETCHBLT
453
+ - EMR_STRETCHDIBITS
454
+ - EMR_TRANSPARENTBLT
455
+ citation: MS-WMF 2.2.2.3
456
+ status: implemented
457
+ reason:
458
+ - id: emf.bitmap.colorref_reserved
459
+ format: emf
460
+ record_types:
461
+ - EMR_ALPHABLEND
462
+ - EMR_BITBLT
463
+ - EMR_MASKBLT
464
+ - EMR_PLGBLT
465
+ - EMR_SETDIBITSTODEVICE
466
+ - EMR_STRETCHBLT
467
+ - EMR_STRETCHDIBITS
468
+ - EMR_TRANSPARENTBLT
469
+ citation: MS-WMF 2.2.2.8
470
+ status: implemented
471
+ reason:
472
+ - id: emf.bitmap.colorref_palette
473
+ format: emf
474
+ record_types:
475
+ - EMR_ALPHABLEND
476
+ - EMR_BITBLT
477
+ - EMR_MASKBLT
478
+ - EMR_PLGBLT
479
+ - EMR_SETDIBITSTODEVICE
480
+ - EMR_STRETCHBLT
481
+ - EMR_STRETCHDIBITS
482
+ - EMR_TRANSPARENTBLT
483
+ citation: MS-WMF 2.2.2.8
484
+ status: implemented
485
+ reason:
486
+ - id: emf.bitmap.source_rectangle
487
+ format: emf
488
+ record_types:
489
+ - EMR_ALPHABLEND
490
+ - EMR_BITBLT
491
+ - EMR_MASKBLT
492
+ - EMR_PLGBLT
493
+ - EMR_SETDIBITSTODEVICE
494
+ - EMR_STRETCHBLT
495
+ - EMR_STRETCHDIBITS
496
+ - EMR_TRANSPARENTBLT
497
+ citation: MS-EMF 2.3.1
498
+ status: not_checkable
499
+ reason: the spec states no bound relating xSrc/ySrc/cxSrc/cySrc or iStartScan/cScans
500
+ to the bitmap size (cScans only bounds the stride check)
501
+ - id: emf.bitmap.xform_src
502
+ format: emf
503
+ record_types:
504
+ - EMR_ALPHABLEND
505
+ - EMR_BITBLT
506
+ - EMR_MASKBLT
507
+ - EMR_PLGBLT
508
+ - EMR_SETDIBITSTODEVICE
509
+ - EMR_STRETCHBLT
510
+ - EMR_STRETCHDIBITS
511
+ - EMR_TRANSPARENTBLT
512
+ citation: MS-EMF 2.2.28
513
+ status: not_checkable
514
+ reason: 'no normative clause: XForm (MS-EMF 2.2.28) types its six members as FLOAT
515
+ without a range, and the bitmap records say a transform SHOULD be applied, so
516
+ a non-finite XformSrc breaks no MUST'
517
+ - id: emf.comment.private_identifier
518
+ format: emf
519
+ record_types:
520
+ - EMR_COMMENT
521
+ citation: MS-EMF 2.3.3.1
522
+ status: not_checkable
523
+ reason: private data that begins with a predefined identifier is dispatched as that
524
+ comment type by definition
525
+ - id: emf.comment.emfplus
526
+ format: emf
527
+ record_types:
528
+ - EMR_COMMENT
529
+ citation: MS-EMF 2.3.3.2
530
+ status: not_checkable
531
+ reason: EMF+ comment payloads are covered by the emfplus.* rules, not this family
532
+ - id: emf.comment.emfspool_payload
533
+ format: emf
534
+ record_types:
535
+ - EMR_COMMENT
536
+ citation: MS-EMF 2.3.3.3
537
+ status: not_checkable
538
+ reason: the records after EMFSpoolRecordIdentifier are defined by [MS-EMFSPOOL],
539
+ which is not in the reference set; MS-EMF names only the identifier value 0x544F4E46
540
+ ("TONE")
541
+ - id: emf.escape.escape_id
542
+ format: emf
543
+ record_types:
544
+ - EMR_DRAWESCAPE
545
+ - EMR_EXTESCAPE
546
+ - EMR_NAMEDESCAPE
547
+ citation: MS-EMF 2.3.6
548
+ status: not_checkable
549
+ reason: iEscape values are printer-driver defined and not enumerated by MS-EMF
550
+ - id: emf.escape.payload_semantics
551
+ format: emf
552
+ record_types:
553
+ - EMR_DRAWESCAPE
554
+ - EMR_EXTESCAPE
555
+ - EMR_NAMEDESCAPE
556
+ citation: MS-EMF 2.3.6
557
+ status: not_checkable
558
+ reason: the escape Data is passed to the printer driver and defined by the driver;
559
+ MS-EMF states only that cjIn bytes MUST be available (checked by emf.escape.payload_bounds)
560
+ - id: emf.opengl.payload_semantics
561
+ format: emf
562
+ record_types:
563
+ - EMR_GLSRECORD
564
+ - EMR_GLSBOUNDEDRECORD
565
+ citation: MS-EMF 2.3.9
566
+ status: not_checkable
567
+ reason: Data holds an OpenGL function call defined by [OPENGL]; MS-EMF states only
568
+ the cbData size (checked by emf.opengl.payload_bounds)
569
+ - id: emf.opaque.text_arrays
570
+ format: emf
571
+ record_types:
572
+ - EMR_POLYTEXTOUTA
573
+ - EMR_POLYTEXTOUTW
574
+ citation: MS-EMF 2.3.5.32
575
+ status: implemented
576
+ reason: null
577
+ - id: emf.opaque.colorspace_fields
578
+ format: emf
579
+ record_types:
580
+ - EMR_CREATECOLORSPACE
581
+ - EMR_CREATECOLORSPACEW
582
+ citation: MS-WMF 2.2.2.11
583
+ status: implemented
584
+ reason:
585
+ - id: emf.opaque.state_fields
586
+ format: emf
587
+ record_types:
588
+ - EMR_SETCOLORADJUSTMENT
589
+ - EMR_PIXELFORMAT
590
+ - EMR_FORCEUFIMAPPING
591
+ - EMR_COLORCORRECTPALETTE
592
+ - EMR_SETLINKEDUFIS
593
+ - EMR_SETICMPROFILEA
594
+ - EMR_SETICMPROFILEW
595
+ - EMR_COLORMATCHTOTARGETW
596
+ citation: MS-EMF 2.3.11
597
+ status: deferred
598
+ reason: 'all fields are readable from the record bytes; the size/count/enum clauses
599
+ are covered by emf.opaque.*, emf.state.color_adjustment, emf.state.pixel_format_version,
600
+ emf.state.color_match_target, emf.state.profile_bounds and emf.state.linked_ufis_bounds;
601
+ not written: PixelFormatDescriptor value fields, UFI ids, COLORCORRECTPALETTE
602
+ index range and ICM flag values'
603
+ - id: emf.comment.windows_metafile_content
604
+ format: emf
605
+ record_types:
606
+ - EMR_COMMENT
607
+ citation: MS-EMF 2.3.3.4.4
608
+ status: deferred
609
+ reason: 'WinMetafile bytes are readable from the comment, not written: checking
610
+ the embedded WMF would run the wmf.* rules on a nested buffer; the Checksum algorithm
611
+ is not given in the reference text'
612
+ - id: emf.opaque.colorspace_handles
613
+ format: emf
614
+ record_types:
615
+ - EMR_SETCOLORSPACE
616
+ - EMR_DELETECOLORSPACE
617
+ - EMR_CREATECOLORSPACE
618
+ - EMR_CREATECOLORSPACEW
619
+ citation: MS-EMF 2.3.8
620
+ status: deferred
621
+ reason: ihCS lifecycle (set/delete against a created colour space) needs object-table
622
+ tracking; the handle is readable from the record bytes
@@ -0,0 +1,61 @@
1
+ # EMF control-record buffers (work item W07): header description / pixel format and the EOF palette.
2
+ - id: emf.header.description_terminator
3
+ format: emf
4
+ record_types: [EMR_HEADER]
5
+ citation: "MS-EMF 2.3.4.2"
6
+ status: implemented
7
+ reason: null
8
+ - id: emf.header.description_string
9
+ format: emf
10
+ record_types: [EMR_HEADER]
11
+ citation: "MS-EMF 2.2.9"
12
+ status: not_checkable
13
+ reason: "The spec gives the description arbitrary content and length (only null termination, checked by emf.header.description_terminator, and the record bounds, checked by emf.header.description_bounds, are requirements), so nDescription cannot be compared with any other string length."
14
+ - id: emf.header.pixel_format_size
15
+ format: emf
16
+ record_types: [EMR_HEADER]
17
+ citation: "MS-EMF 2.2.10"
18
+ status: implemented
19
+ reason: null
20
+ - id: emf.header.pixel_format_content
21
+ format: emf
22
+ record_types: [EMR_HEADER]
23
+ citation: "MS-EMF 2.2.22"
24
+ status: implemented
25
+ reason: null
26
+ - id: emf.header.buffers_overlap
27
+ format: emf
28
+ record_types: [EMR_HEADER]
29
+ citation: "MS-EMF 2.3.4.2"
30
+ status: implemented
31
+ reason: null
32
+ - id: emf.header.extension_field_order
33
+ format: emf
34
+ record_types: [EMR_HEADER]
35
+ citation: "MS-EMF 2.3.4.2"
36
+ status: not_checkable
37
+ reason: "The spec lets the optional variable-length fields appear in any order after the fixed part; the only checkable constraint, that the description and pixel format do not overlap, is emf.header.buffers_overlap. The HeaderSize determination algorithm (figure 3) is an image, so the exact fixed-part size per header type is not machine-readable."
38
+ - id: emf.header.reserved_and_padding
39
+ format: emf
40
+ record_types: [EMR_HEADER]
41
+ citation: "MS-EMF 2.2.9"
42
+ status: not_checkable
43
+ reason: "The Reserved field and the up-to-3 alignment padding bytes MUST be ignored on receipt, so the spec puts no requirement on their values."
44
+ - id: emf.eof.palette_entries
45
+ format: emf
46
+ record_types: [EMR_EOF]
47
+ citation: "MS-EMF 2.2.9"
48
+ status: implemented
49
+ reason: null
50
+ - id: emf.eof.palette_bounds
51
+ format: emf
52
+ record_types: [EMR_EOF]
53
+ citation: "MS-EMF 2.3.4.1"
54
+ status: implemented
55
+ reason: null
56
+ - id: emf.eof.size_last_position
57
+ format: emf
58
+ record_types: [EMR_EOF]
59
+ citation: "MS-EMF 2.3.4.1"
60
+ status: not_checkable
61
+ reason: "Covered by emf.eof.size_last (rules/emf_framing.rb), which reads the last four serialized bytes of the EOF record and so checks both the value and that SizeLast is the final field after any palette. emf.eof.palette_bounds checks the palette precedes it. No separate rule."