mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Re-factor how the GenericL10n
class fetches localization-data
- Re-factor the existing `fetchData` helper function such that it can fetch more types of data, and it now supports "arraybuffer", "json", and "text". This only needed minor adjustments in the `DOMCMapReaderFactory` and `DOMStandardFontDataFactory` classes.[1] - Expose the `fetchData` helper function in the API, such that the viewer is able to access it. - Use the `fetchData` helper function in the `GenericL10n` class, since this should allow fetching of localization-data even if the default viewer is run in an environment without support for the Fetch API. --- [1] While testing this I also noticed a minor inconsistency when handling standard font-data on the worker-thread.
This commit is contained in:
parent
44cde3ccca
commit
709d89420e
6 changed files with 45 additions and 20 deletions
|
@ -425,7 +425,7 @@ class PartialEvaluator {
|
|||
`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`
|
||||
);
|
||||
} else {
|
||||
data = await response.arrayBuffer();
|
||||
data = new Uint8Array(await response.arrayBuffer());
|
||||
}
|
||||
} else {
|
||||
// Get the data on the main-thread instead.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue