Work around IE9 bug that caches font-family lookups and doesn't reset them when @font-face changes the family
This commit is contained in:
parent
cce1ff7cf1
commit
f55fc96ca3
|
@ -163,16 +163,18 @@
|
||||||
|
|
||||||
fontFace: function (name) {
|
fontFace: function (name) {
|
||||||
var type = HTMLCSS.allowWebFonts;
|
var type = HTMLCSS.allowWebFonts;
|
||||||
|
var FONT = HTMLCSS.FONTDATA.FONTS[name];
|
||||||
|
if (HTMLCSS.msieFontCSSBug && !FONT.family.match(/-Web$/)) {FONT.family += "-Web"}
|
||||||
var dir = AJAX.fileURL(HTMLCSS.webfontDir+"/"+type);
|
var dir = AJAX.fileURL(HTMLCSS.webfontDir+"/"+type);
|
||||||
var fullname = name.replace(/-b/,"-B").replace(/-i/,"-I").replace(/-Bold-/,"-Bold");
|
var fullname = name.replace(/-b/,"-B").replace(/-i/,"-I").replace(/-Bold-/,"-Bold");
|
||||||
if (!fullname.match(/-/)) {fullname += "-Regular"}
|
if (!fullname.match(/-/)) {fullname += "-Regular"}
|
||||||
if (type === "svg") {fullname += ".svg#"+fullname} else {fullname += "."+type}
|
if (type === "svg") {fullname += ".svg#"+fullname} else {fullname += "."+type}
|
||||||
var def = {
|
var def = {
|
||||||
"font-family": HTMLCSS.FONTDATA.FONTS[name].family,
|
"font-family": FONT.family,
|
||||||
src: "url('"+dir+"/"+fullname+"')"
|
src: "url('"+dir+"/"+fullname+"')"
|
||||||
};
|
};
|
||||||
if (type === "svg") def.src += " format('svg')";
|
if (type === "svg") def.src += " format('svg')";
|
||||||
if (!(HTMLCSS.FontFaceBug && HTMLCSS.FONTDATA.FONTS[name].isWebFont)) {
|
if (!(HTMLCSS.FontFaceBug && FONT.isWebFont)) {
|
||||||
if (name.match(/-bold/)) {def["font-weight"] = "bold"}
|
if (name.match(/-bold/)) {def["font-weight"] = "bold"}
|
||||||
if (name.match(/-italic/)) {def["font-style"] = "italic"}
|
if (name.match(/-italic/)) {def["font-style"] = "italic"}
|
||||||
}
|
}
|
||||||
|
@ -466,7 +468,10 @@
|
||||||
{FONTS[name].available = true; return null}
|
{FONTS[name].available = true; return null}
|
||||||
if (!this.allowWebFonts) {return null}
|
if (!this.allowWebFonts) {return null}
|
||||||
FONTS[name].isWebFont = true;
|
FONTS[name].isWebFont = true;
|
||||||
if (HTMLCSS.FontFaceBug) {FONTS[name].family = name}
|
if (HTMLCSS.FontFaceBug) {
|
||||||
|
FONTS[name].family = name;
|
||||||
|
if (HTMLCSS.msieFontCSSBug) {FONTS[name].family += "-Web"}
|
||||||
|
}
|
||||||
return AJAX.Styles({"@font-face":this.Font.fontFace(name)});
|
return AJAX.Styles({"@font-face":this.Font.fontFace(name)});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1068,7 +1073,10 @@
|
||||||
|
|
||||||
loadWebFont: function (font) {
|
loadWebFont: function (font) {
|
||||||
font.available = font.isWebFont = true;
|
font.available = font.isWebFont = true;
|
||||||
if (HTMLCSS.FontFaceBug) {font.family = font.name}
|
if (HTMLCSS.FontFaceBug) {
|
||||||
|
font.family = font.name;
|
||||||
|
if (HTMLCSS.msieFontCSSBug) {font.family += "-Web"}
|
||||||
|
}
|
||||||
HUB.RestartAfter(this.Font.loadWebFont(font));
|
HUB.RestartAfter(this.Font.loadWebFont(font));
|
||||||
},
|
},
|
||||||
loadWebFontError: function (font,done) {
|
loadWebFontError: function (font,done) {
|
||||||
|
@ -2152,6 +2160,7 @@
|
||||||
msieItalicWidthBug: true,
|
msieItalicWidthBug: true,
|
||||||
zeroWidthBug: true,
|
zeroWidthBug: true,
|
||||||
FontFaceBug: true,
|
FontFaceBug: true,
|
||||||
|
msieFontCSSBug: browser.isIE9,
|
||||||
allowWebFonts: "eot"
|
allowWebFonts: "eot"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user