mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-06 15:15:47 +02:00
encodeString has the same surrogate-pair guard that encodeToXmlString had before #21526: `unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)`. That predicate is also true for U+FFFE and U+FFFF, which are single UTF-16 code units, not surrogate pairs. The extra `i++` then steps over the character that follows them, so it is silently dropped from the font-encoded output used when saving or printing a PDF. For example, encoding a string that is U+FFFF followed by "A", with a font that has a glyph for both, returns an encoded result ending in "A" on this branch but drops the "A" on master. Same fix as #21526: the correct test for a real surrogate pair is `unicode > 0xffff`, since codePointAt only returns a value at or above 0x10000 for an actual pair. This keeps existing behavior for real surrogate pairs (e.g. emoji) and the U+FFFD boundary, and only stops the character after U+FFFE/U+FFFF from being dropped. Added test/unit/fonts_spec.js, since Font.prototype.encodeString had no direct unit test. It calls the method on a minimal fake `this` (only toUnicode/cMap are read), since building a full Font requires a complete properties/font-file setup that this bug doesn't depend on.
72 lines
1.8 KiB
JSON
72 lines
1.8 KiB
JSON
{
|
|
"spec_dir": "build/lib-legacy/test/unit",
|
|
|
|
"helpers": ["clitests_helper.js"],
|
|
|
|
"spec_files": [
|
|
"annotation_spec.js",
|
|
"annotation_storage_spec.js",
|
|
"api_spec.js",
|
|
"app_options_spec.js",
|
|
"autolinker_spec.js",
|
|
"bidi_spec.js",
|
|
"canvas_factory_spec.js",
|
|
"cff_parser_spec.js",
|
|
"cmap_spec.js",
|
|
"colorspace_spec.js",
|
|
"core_utils_spec.js",
|
|
"crypto_spec.js",
|
|
"custom_spec.js",
|
|
"default_appearance_spec.js",
|
|
"display_utils_spec.js",
|
|
"document_spec.js",
|
|
"editor_spec.js",
|
|
"encodings_spec.js",
|
|
"evaluator_spec.js",
|
|
"event_utils_spec.js",
|
|
"fetch_stream_spec.js",
|
|
"font_substitutions_spec.js",
|
|
"fonts_spec.js",
|
|
"image_utils_spec.js",
|
|
"message_handler_spec.js",
|
|
"metadata_spec.js",
|
|
"murmurhash3_spec.js",
|
|
"name_number_tree_spec.js",
|
|
"network_utils_spec.js",
|
|
"node_stream_spec.js",
|
|
"obj_bin_transform_spec.js",
|
|
"operator_list_dependencies_spec.js",
|
|
"parser_spec.js",
|
|
"pattern_spec.js",
|
|
"pdf.image_decoders_spec.js",
|
|
"pdf.worker_spec.js",
|
|
"pdf_find_controller_spec.js",
|
|
"pdf_find_utils_spec.js",
|
|
"pdf_history_spec.js",
|
|
"pdf_link_service_spec.js",
|
|
"pdf_spec.js",
|
|
"pdf_viewer.component_spec.js",
|
|
"pdf_viewer_spec.js",
|
|
"postscript_spec.js",
|
|
"primitives_spec.js",
|
|
"scripting_utils_spec.js",
|
|
"sound_spec.js",
|
|
"stream_spec.js",
|
|
"string_utils_spec.js",
|
|
"struct_tree_spec.js",
|
|
"svg_factory_spec.js",
|
|
"text_layer_spec.js",
|
|
"to_unicode_map_spec.js",
|
|
"type1_parser_spec.js",
|
|
"ui_utils_spec.js",
|
|
"unicode_spec.js",
|
|
"util_spec.js",
|
|
"writer_spec.js",
|
|
"xfa_formcalc_spec.js",
|
|
"xfa_parser_spec.js",
|
|
"xfa_serialize_data_spec.js",
|
|
"xfa_tohtml_spec.js",
|
|
"xml_spec.js"
|
|
]
|
|
}
|