Closed Bug 295193 (mathml-fonts) Opened 15 years ago Closed 3 years ago
Allow downloading math fonts / bundle math fonts with Firefox for better Math
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 Once the STIX project releases the font files, modify installer to optionally download STIX Fonts during the install or even bundle the font files with the installer. Additional fonts are often required for MathML support. Reproducible: Always Steps to Reproduce: STIX Fonts progress can be tracked at http://stixfonts.org/finalsteps.html "A beta test release is planned for July 2005."
This is an automated message, with ID "auto-resolve01". This bug has had no comments for a long time. Statistically, we have found that bug reports that have not been confirmed by a second user after three months are highly unlikely to be the source of a fix to the code. While your input is very important to us, our resources are limited and so we are asking for your help in focussing our efforts. If you can still reproduce this problem in the latest version of the product (see below for how to obtain a copy) or, for feature requests, if it's not present in the latest version and you still believe we should implement it, please visit the URL of this bug (given at the top of this mail) and add a comment to that effect, giving more reproduction information if you have it. If it is not a problem any longer, you need take no action. If this bug is not changed in any way in the next two weeks, it will be automatically resolved. Thank you for your help in this matter. The latest beta releases can be obtained from: Firefox: http://www.mozilla.org/projects/firefox/ Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html Seamonkey: http://www.mozilla.org/projects/seamonkey/
The target release for this font pack is now December 2005. The website is http://www.stixfonts.org/ . So I think this bug is still valid to keep track of this.
The STI Pub group web site claims that "A beta test release is planned for October 2005[...] general release of the fonts (December 2005) has been established". In addition, the draft license should probably be reviewed by somebody who knows about legal issues so that Mozilla can distribute the fonts in future. STI Pub group is waiting for comments... See also: http://www.stixfonts.org/news.html http://www.stixfonts.org/user_license.html Marking this bug to depend on bug 86247. If we get an .xpi font bundle, then STIX fonts should be part of it.
Depends on: 86247
Seems valid to me -> NEW
Status: UNCONFIRMED → NEW
Ever confirmed: true
The site (http://stixfonts.org/) now says "Beta Fonts Will Be Released on 31 October" (tomorrow). If somebody with enough knowledge is able to test the font with Firefox during the beta, then perhaps the possible issues in the font could be fixed before the final release.
The site (http://stixfonts.org) now shows that the fonts are released as beta and can be downloaded. Some members of the MathML WG have downloaded them and were very impressed. I think that the integration of the stix fonts into FF and TB (and possibly an installer extension; the license seems to allow this) would be one of the greatest steps forward for MathML in Mozilla since turning it on by default years ago.
With presently deployed PDF every user is interested in documents that unbeknownst to her contain math. If we're not careful, failure to include needed fonts could become an obstacle to substantial deployment of MathML in web pages. The additional download time is not significant. For example, these days people commonly retrieve pdf files like http://www2.imperial.ac.uk/ssherw/physflow/pfn/Meetings/Nottingham/Presentations/Notts%20Physiome%20Project%202005%20small.pdf -- a document containing math -- that are the size of the Firefox download. Items of that size today require 10 seconds through an at-home cable modem connection here in New York. Adding the STIX fonts would change that to 10.8 seconds. Let's make Firefox the best browser it can be by default.
Do we think that we can add the fonts to Firefox? If so, can someone with the relevant skills create a patch for this bug and ask for review? I suspect that the reviewers will not allow the fonts to be added without some convincing. Would it be acceptable to drive this via a preference? For example, if there was a checkbox in the 'Content' preference window which said 'Use MathML (and download MathML font)". When the checkbox is checked, the download can be initiated and they can be installed. This would make the default installed size of FF no bigger, but it would allow for a one-step install of the fonts.
With the soon expected release of the stable FF3 version, the solution of this bug becomes urgent. I propose a simple, not yet discussed solution, to deliver STIX fonts to the clients that use MathML, together with the downloading of FF3, and without going through the burden of their installation in the appropriate OS platform. Most of the clients are not developers, and the burden of installing the fonts becomes intolerable. On May 25 I opened a thread in the mathml-list called "STIX fonts for clients" mathhttp://groups.google.com/group/mozilla.dev.tech.mathml/browse_thread/thread/2c4a53f71f0144fd but unfortunately no one of the FF MathML team took part so far. The first part of the proposed solution is not mine, and I fill an agreement among the MathML team to present to the clients the choice of adding the fonts when downloading the browser without increasing its time for people not using MathML. Besides that, the increase of time is about 16% (the fonts take space of 1.2MB, compared to 7.5MB of the browser). Now comes the second part: By downloading of the browser, the fonts will be just put in a new directory of the installed browser, without doing the fonts' installation in the platform. The browser should take care to look for these fonts in this directory, when a <math ..> element is encountered, instead of looking among the installed fonts in the system (as for now). That way the task of fonts' installation, which differs from platform to platform is avoided. I don't see any legal problem, or any complication, in the application of such a simple and quick solution. Cheers, Samy
Please not that now STIX is distributed as part of many distributions, using an embedded version instead of the system one is a no-go. MoFo should definitely enhance the visibility of good Free/Open fonts such as Stix, but it should never shortcut the system font repository
Given that we now support downloadable fonts, this isn't necessarily an installer issue anymore. We could also have fonts that are part of the Firefox distribution that are installed using (literal or implicit) @font-face rules in the user-agent style sheet. Potential issues with shipping STIX fonts that I can think of, though, are: * download size * license compatibility
Perhaps mozilla foundation could provide bandwith for STIX fonts? I believe that the STIX license allows that. If that's possible, then Firefox can include user-agent rules to prefer locally installed STIX fonts and as a fallback provide an URL to a copy provided by mozilla foundation (provided with suitable CORS setup if needed). Then firefox would automatically load the STIX fonts to browser cache first time its needed on any page. This would allow the browser to throw the font away if it's not needed later (normal cache expiry process). However, if a site sets its own preferences for fonts used for math, the a default setting in user-agent style would not be used and as a result, the user could end up without a working display of mathematical glyphs. Perhaps math elements could have some kind of magic fallback value for font-family that includes a remote STIX font distrobuted from mozilla foundation server?
Now that the STIX fonts are officially released. When a user visits a page with MathML and they do NOT have the STIX fonts installed, a pop-up should appear with the download location of the fonts and a recommendation that they be downloaded for the best viewing experience. Also the page "Fonts for MathML-enabled Mozilla" at: https://developer.mozilla.org/en/Mozilla_MathML_Project/Fonts should be updated to no longer suggest using the STIX Beta Fonts but instead the official final release STIX 1.0 Fonts.
The license is as this one http://sourceforge.net/projects/stixfonts/files/STIXFontLicense2010.txt/download It is pretty simple and seems to allow the embedding in any software. The package of fonts weights for 800 kB, so it would be a great package, it will be noticed. I vote for the solution in comment 14, and implement the solution to this "bug" as if it was a plugin not installed but managing the installation by itself.
There have been important changes regarding the fonts used in MathML since the bug was opened. Please read https://developer.mozilla.org/en/Mozilla_MathML_Project/Fonts for details. Downloadable fonts can be used when the glyphs are used in MathML text (I think), but not yet for stretchy mathematical operator until we rewrite the nsMathMLChar class (see bug 663740). Maybe a way to work around the issues mentioned in comment 12 will be to fix bug 86247 (i.e. create an XPI file) and distribute it as an extension.
When bug 736010 is fixed, people will be able to use the following add-on: https://addons.mozilla.org/en-US/firefox/addon/mathml-fonts/ After that, maybe we want to add something to advertise users that fonts are missing and suggest installation of this add-on? In the past, we had an alert pop-pup that appeared when MathML fonts were not found, but the UI was unfriendly. It was suggested in bug 309090 to replace it by an information bar, so maybe that's what we should do... Does anyone know if we have an interface for that purpose now? The code checking missing fonts was removed here: http://hg.mozilla.org/mozilla-central/rev/838238a0df33 If we add it again, I guess the following comment should be taken into consideration: "We don't really need all these fonts, so alerting on some missing is not right. The best place to alert would be Stretch when we notice that we can't get the char we want. In this way the user would not be alerted unnecessarily when the document contains only simple math. The alert also needs a "don't tell me again box"
(In reply to Frédéric Wang from comment #18) > It was suggested in bug 309090 to > replace it by an information bar, so maybe that's what we should do... Does > anyone know if we have an interface for that purpose now? For detecting whether MathML fonts are missing or for displaying a notification bar? (for latter see https://developer.mozilla.org/en/Code_snippets/Alerts_and_Notifications#Using_notification_box)
From C++ code what you would do is that (once you had decided to generate a notification) you would dispatch a runnable (since the chances are you're doing this deep within layout or painting where it's unsafe to run script) which would then either dispatch a DOM event or possibly an nsIObserver notification, which the application could then choose to handle in an appropriate manner.
About the place where to launch the notification, I think that would be in nsMathMLChar::Stretch just after going out from nsMathMLChar::StretchInternal. We would verify whether we haven't been able to find a size variant or to determine how to build the operators by parts. This notification should probably only be sent for the most common operators like delimiters, sum or square root. Indeed, there are exotic stretchy operators (some arrows for example) that we can't stretch with any of our fonts and so we don't want to send a notification in that case. If we use a runnable as described in https://developer.mozilla.org/en/Making_Cross-Thread_Calls_Using_Runnables will it be possible to use the notificationbox object? Also if we want a "Do not show this message again" button, how can we memorize the user choice? With a preference option or something else?
(In reply to Frédéric Wang from comment #21) > If we use a runnable will it be possible to use the notificationbox object? Since you are working deep within the bowels of layout, it is almost certain that you will need to use a runnable whose eventual job it is to trigger the desired notification. However the runnable probably won't create the UI itself, instead as I suggested earlier a DOM event or an observer notification is the easiest way to notify the application's front-end code. > Also if we want a "Do not show this message again" button, how can we > memorize the user choice? With a preference option or something else? A preference would seem to be the most straightforward route; the front end can set the preference when it wants the back end to stop generating notifications.
(In reply to firstname.lastname@example.org from comment #22) > However the runnable probably won't create the UI > itself, instead as I suggested earlier a DOM event or an observer > notification is the easiest way to notify the application's front-end code. I meant in order to write this UI in the application's front-end code, I suppose I can add a js file somewhere that handles this DOM event and uses https://developer.mozilla.org/en/Code_snippets/Alerts_and_Notifications#Using_notification_box to display the notification bar? Or do I have to rewrite a UI for the notification bar? For example can I add something in browser/base/content so that this notification bar is available to all Gecko-based applications? I don't really know the front-end code, so I'm not sure what is the appropriate way to add such a feature.
(In reply to Frédéric Wang from comment #23) > I meant in order to write this UI in the application's front-end code, I > suppose I can add a js file somewhere that handles this DOM event and uses > > https://developer.mozilla.org/en/Code_snippets/Alerts_and_Notifications#Using_notification_box > > to display the notification bar? Or do I have to rewrite a UI for the > notification bar? > > For example can I add something in browser/base/content so that this > notification bar is available to all Gecko-based applications? You would want to add code to browser/base/content/browser.js so that Firefox could display an appropriate notification. Other applications that wanted to handle the notification would need to write their own implementation.
@karl: how do you think we can detect that fonts on the system (or downloaded) are not sufficient? The old CheckFontExistence function didn't work AFAIK and I'm not sure verifying stretch failure will always work.
Assignee: nobody → fred.wang
Status: NEW → ASSIGNED
Version: unspecified → Trunk
Comment on attachment 607024 [details] [diff] [review] Patch UI V1 I'm no browser peer but I believe that gNavigatorBundle refers to a XUL stringbundle element that represents the browser.properties bundle. (Note that the API is slightly different, see MDN for details.)
(In reply to Frédéric Wang from comment #25) > @karl: how do you think we can detect that fonts on the system (or > downloaded) are not sufficient? I guess it's a similar situation to when we fall back to scaling the fonts. Scaling the fonts is probably sufficient in many cases. Perhaps check for large scale factors. But for some characters there may be situations where we need large scale factors even with the best fonts. So, perhaps check for large scale factors, but only on characters that we know could be built from parts to any size (and thus shouldn't need scaling). I haven't thought much about this. You may be able to think of something better.
A key thing here is to find the most common situation(s) where a lack of fonts causes significant problems and check that the detection method identifies these.
(In reply to email@example.com from comment #28) > Comment on attachment 607024 [details] [diff] [review] > Patch UI V1 > > I'm no browser peer but I believe that gNavigatorBundle refers to a XUL > stringbundle element that represents the browser.properties bundle. (Note > that the API is slightly different, see MDN for details.) Thanks for the hint. I updated the patch in my github repository. Currently, when the user clicks on the "Install Add-on" button, the add-on patch is opened in a new tab. Is there a way to directly display the install prompt directly?
(In reply to Frédéric Wang from comment #31) > Currently, when the user clicks on the "Install Add-on" button, the add-on > patch is opened in a new tab. Is there a way to directly display the install > prompt directly? You'd best talk to the user experience team as to what the best way to go is. (Personally I would find it reasonable for the AMO page to open in a new tab.)
(In reply to Frédéric Wang from comment #33) > Created attachment 609848 [details] [diff] [review] > Patch Gecko V2 Karl, it seems that with this patch, the warning does not appear when MathML fonts are installed but it does when downloaded MathML fonts are used instead... Any idea why it could behave like this? (I'm testing with patch for bug 736010 applied)
No ideas. I expected system and downloaded fonts to behave the same after bug 736010 is resolved. Stepping through with a debugger or logging could show the difference.
I tried with a page with a single sum symbol and added logging in StretchInternal when !maxWidth: - when the fonts are installed, StretchInternal is called twice and the glyph is always found. - when the fonts are not installed, StretchInternal is called twice and the glyph is never found. - when the fonts are not installed, but the add-on that uses WOFF fonts is installed, StretchInternal is called three times. The two first times the glyph is not found and the third one it is. The MDN doc about @font-face contains the following note: "When Gecko displays a page that uses web fonts, it initially displays text using the best CSS fallback font available on the user's computer while it waits for the web font to finish downloading. As each web font finishes downloading, Gecko updates the text that uses that font. This allows the user to read the text on the page more quickly." So I guess that at the beginning local fonts are tried and not found and so that triggers the warning. Once the fonts are available, the new glyph available is used and so the page is displayed correctly. I'm not sure how we can work around that issue. I can make the add-on modify the preference to avoid triggering the warning, but that won't work for users who use @font-face rules in their pages.
That all makes sense. When a font download is triggered, I wonder whether that flags the document load as incomplete somehow. Perhaps that can be checked before triggering a warning?
Can someone from the Gecko team please indicate if it is possible to know whether the Web fonts for a given document are still being downloaded or already available? (cf previous comments)
(In reply to Karl Tomlinson (:karlt) from comment #38) > When a font download is triggered, I wonder whether that flags the document > load as incomplete somehow. It does, but that doesn't solve your problem since the document might already have finished loading and have some MathML added to it or something. It would be easy to add a C++ API to nsPresContext for this; just check mUserFontSet and, if it's non-null, whether mLoaders is empty. You probably also want the ability to receive a callback when status changes from "loading fonts" to "all fonts loaded"; that would also be easy. Then you can use that from your first patch.
Yeah, we've had requests for that anyway (e.g. from the pdf.js folks).
That seems to work, thanks.
Attachment #609848 - Attachment is obsolete: true
(In reply to Frédéric Wang from comment #42) > Created attachment 611754 [details] [diff] [review] > Patch Gecko V3 > > That seems to work, thanks. the modules/libpref/src/init/all.js part of this patch has bit-rotted.
Comment on attachment 619695 [details] [diff] [review] Patch UI V3 I don't think I'm the best person to review this but requesting review from someone who might be more applicable to review it.
Attachment #619695 - Flags: review?(netzen) → review?(felipc)
I don't think prompting users to install an add-on is going to be a very effective solution (notification bars are easy to ignore, and installing add-ons is a bit of a pain). If we think we want to promote usage of these fonts, we should do it by bundling the fonts (resolving any of the licensing issues, if necessary). Is there a reason why we can't do that?
Attachment #619695 - Flags: review?(felipc)
(In reply to :Gavin Sharp (use firstname.lastname@example.org for email) from comment #47) > Is there a reason why we can't do that? Download size. I think the ideal thing would be to silently download the fonts when they're first needed.
How large are these fonts?
- Bundling the fonts is a problem because of font size (comment 12, the STIX fonts are > 1Mb) and it is also not really clean compared to a normal system installation (comment 11). - I'm not sure how we will silently download the fonts. I guess WOFF fonts will be made available on a Mozilla server and we will force the download as if one had specified @font-face rules. But is it really a good idea to do so without telling the user? And I guess the fonts disappear when the cache is cleared? The proposed approach is using a notification bar to warn the user only when stretching failure happen, so when the fonts seem really necessary. Notification can be ignored and that's on purpose (people complained about the former alert warning that happened each time one went on a page with MathML content, without the recommended fonts installed). So the goal is not at all to force the users to have the fonts installed but rather to suggest them that fonts may be necessary. Most people are not aware of that and complain about why the rendering is ugly. Having this notification message is a good way to inform users about this need. Some people would prefer doing a "clean" installation i.e. using the installation manager or whatever standard method from their systems. The restartless add-on helps users to install the fonts easily when they are not already provided by their operating systems and/or can hardly be installed (e.g. on mobile platforms). Finally, I expected that this approach (using an external add-on, with minimal changes to the codebase) could be more easily accepted by the Mozilla drivers...
(In reply to :Gavin Sharp (use email@example.com for email) from comment #47) > I don't think prompting users to install an add-on is going to be a very > effective solution (notification bars are easy to ignore, and installing > add-ons is a bit of a pain). If we think we want to promote usage of these > fonts, we should do it by bundling the fonts (resolving any of the licensing > issues, if necessary). Is there a reason why we can't do that? And is there any strong reason against not accepting this patch? The notification bar informs the user about the lack of fonts, suggests to install them, and does not download them without his agreement. Ideally, the user's operating system should provide a way to easily install the fonts. When that's not the case, the add-on may be use as an alternative method to install the fonts and keep them up-to-date.
(In reply to Frédéric Wang (:fredw) from comment #51) > (In reply to :Gavin Sharp (use firstname.lastname@example.org for email) from comment > #47) > > I don't think prompting users to install an add-on is going to be a very > > effective solution (notification bars are easy to ignore, and installing > > add-ons is a bit of a pain). If we think we want to promote usage of these > > fonts, we should do it by bundling the fonts (resolving any of the licensing > > issues, if necessary). Is there a reason why we can't do that? > > And is there any strong reason against not accepting this patch? The > notification bar informs the user about the lack of fonts, suggests to > install them, and does not download them without his agreement. Ideally, the > user's operating system should provide a way to easily install the fonts. > When that's not the case, the add-on may be use as an alternative method to > install the fonts and keep them up-to-date. Just to add my $.02, this is especially a good solution for mobile devices where there is typically no good way for the user to install fonts without rooting the device.
I just added the regression keyword to this because this is actually used to work as requested by this bug in versions of Firefox prior to Firefox 3.
(In reply to Bill Gianopoulos [:WG9s] from comment #53) > I just added the regression keyword to this because this is actually used to > work as requested by this bug in versions of Firefox prior to Firefox 3. There were installers for Mathematica/TeX fonts (Windows and Mac): http://www-archive.mozilla.org/projects/mathml/fonts/ Comment 0 proposes to modify the Firefox installer to optionally download the fonts, which is a bit different. However, I'm not sure that's the best place to do that. Arguably most Firefox users do not care about math fonts and I would prefer to display an information message only when these fonts are needed. See also bug 767725.
But unless i am remembering incorrectly that was how it worked back int he day. if you referenced a page that used mathml and did not have the requisite fonts you got a popup that led you through installing the fonts appropriate for your OS. Isn't that the equivalent of what is being asked for here (except that now that we can do downloadable fonts, it is possible to do this all via an extensions and not having to install font)?
(In reply to Bill Gianopoulos [:WG9s] from comment #55) > But unless i am remembering incorrectly that was how it worked back int he > day. if you referenced a page that used mathml and did not have the > requisite fonts you got a popup that led you through installing the fonts > appropriate for your OS. Isn't that the equivalent of what is being asked > for here (except that now that we can do downloadable fonts, it is possible > to do this all via an extensions and not having to install font)? Yes, you are right. There was a popup giving a link to the information page. There was a bug that suggested to make the link clickable and another to change the popup into an information bar. And there were Windows & Mac installers on the information page too. Karl also left a comment in the MathML code, to say that the warning should only be displayed when the stretching fail. The proposed patches are exactly taking that approach. Except that the installers are replaced by the add-on, as you indicate.
Given that the patches are fixing a regression and even improving the UI, I still can't see why they can not be accepted... Well, apart that in the past the popup was raised directly from the MathML code and so we didn't need peer approval from other modules. If the add-on approach is a problem, I can just remove the button from the notification bar and only leave the link to the MathML fonts information page. And update this page to let the user decide the best way to install math fonts.
Exactly my point. That is why I suggested the regression keyword was warranted. Just trying to restore the previous behavior here.
Or functionality if not exact behavior.
(In reply to Frédéric Wang (:fredw) from comment #57) > Given that the patches are fixing a regression and even improving the UI, I > still can't see why they can not be accepted... Well, apart that in the past > the popup was raised directly from the MathML code and so we didn't need > peer approval from other modules. > > If the add-on approach is a problem, I can just remove the button from the > notification bar and only leave the link to the MathML fonts information > page. And update this page to let the user decide the best way to install > math fonts. I am also working on a modification to the add-on such that the the additional styles only apply on MathML pages. I would hope that that mitigates any issues with this resulting in performance regressions on non-mathml pages.
(In reply to Frédéric Wang (:fredw) from comment #57) > Given that the patches are fixing a regression and even improving the UI, I > still can't see why they can not be accepted... Well, apart that in the past > the popup was raised directly from the MathML code and so we didn't need > peer approval from other modules. As MathML code, you maintain it. As front-end UI code, others need to maintain it. That's a key difference from my point of view, put aside the question of whether or not a UI-less solution would be better for the MathML community.
So I guess this should be resolved as WONTFIX?
Assignee: fred.wang → nobody
WONTFIX'ing as suggested by comment 62 (in reply to comment 61).
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.