-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Use a local font when the font isn't embedded (bug 1766039) #14844
Conversation
- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1766039; - if the font is not present locally and it has a standard font replacement then use the standard font.
if (!Array.isArray(localNames)) { | ||
localNames = [localNames]; | ||
} | ||
localNames = localNames.map(name => `local('${name}')`).join(" "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are multiple local names to try, I believe the local('...')
entries should be separated by commas, not just spaces.
What sort of overhead does this lead to, given that it'll affect all documents without embedded fonts (of which there are a lot), since it'd force the worker-thread parsing to wait for the main-thread (potentially more than once) which really doesn't seem great in the general case? Hence I cannot help wondering if we should instead perhaps consider always loading the standard font data, since that should also circumvent these types of issues (and we'd not need to depend on users installed fonts)? |
Please correct me if I'm wrong somewhere:
So my ideas would be:
This way there is no overhead in the worker, almost no overhead in main thread (compared to the current situation). |
Thanks!
You're obviously correct about that, and I completely agree that don't want to embed fonts for all the worlds languages (because of the file-sizes and the complexity).
Those ideas are perhaps better to explore in a follow-up, if that's indeed deemed necessary to fix specific bugs.
While I don't know anything about the Please note: There's some cases where worker-thread fetching actually makes sense, even in browsers.
That sounds like a good idea to me...
... and so does this.
That would actually require fixing issue #14843 first though, since otherwise the fonts we load will be too incomplete to be generally helpful. Given that this shouldn't be necessary to fix the referenced bug, unless I'm misunderstanding things, this can probably be deferred until later!? However, if/when we actually implement this we'd still need to have a way to await the
That'd would indeed address my concerns from #14844 (comment), about the worker-thread having to wait for the main-thread.
Above I've tried to outline the situations where we need access to the font-data on the worker-thread (in browsers), however that'd most likely require a different kind of implementation overall. Let's ignore that part for now, or at least here.
Agreed, most (if not all) environments should hopefully have the "standard" fonts available. |
Yep, sure, it's was my plan, I was just enumerating what I've in mind to fix the missing font issues in general.
Yes it's correct: the price to pay in fetching in the main thread will be to use
If we need to have some glyphs outlines, for now it's only possible with fonts where we've the raw font data (so embedded fonts and standard fonts). If for example Liberation has already been loaded on the main thread we can pass the buffer for free in the worker but if we fall back on another one then we'll need to fetch it... but it's only in case we've to display an outline for a missing font so I guess it should be pretty rare.
We could add a dependency on the font to be sure the render will await when we're drawing.
+1
|
What is the next step here? Is there anything I can do to help move this forward? I run into bug 1766039 pretty frequently, making it a challenge to use Firefox as the default PDF viewer on Linux. |
This PR is superseeded by #16363. |
then use the standard font.