зеркало из https://github.com/mozilla/pjs.git
Bug 95227. Allow serif/sansserif defaults to be set per-language. Patch by Masayuki Nakano, r=dbaron,amadare,danm,smontagu,rbs,neil sr=roc
This commit is contained in:
Родитель
bc71b915ac
Коммит
2a34aa6a5d
|
@ -301,11 +301,11 @@ TranslatePropFont(unsigned char *aRegValue, DWORD aRegValueLength,
|
|||
if (isSerif) {
|
||||
prefs->SetCharPref("font.name.serif.x-western",
|
||||
NS_REINTERPRET_CAST(char *, aRegValue));
|
||||
prefs->SetCharPref("font.default", "serif");
|
||||
prefs->SetCharPref("font.default.x-western", "serif");
|
||||
} else {
|
||||
prefs->SetCharPref("font.name.sans-serif.x-western",
|
||||
NS_REINTERPRET_CAST(char *, aRegValue));
|
||||
prefs->SetCharPref("font.default", "sans-serif");
|
||||
prefs->SetCharPref("font.default.x-western", "sans-serif");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ catch(e)
|
|||
var fontEnumerator = null;
|
||||
var globalFonts = null;
|
||||
var fontTypes = ["serif", "sans-serif", "monospace"];
|
||||
var variableSize, fixedSize, minSize, languageList;
|
||||
var defaultFont, variableSize, fixedSize, minSize, languageList;
|
||||
var languageData = [];
|
||||
var currentLanguage;
|
||||
var gPrefutilitiesBundle;
|
||||
|
@ -59,33 +59,28 @@ var gPrefWindow = window.opener.parent.hPrefWindow;
|
|||
function GetFields()
|
||||
{
|
||||
var dataObject = { };
|
||||
|
||||
|
||||
// store data for language independent widgets
|
||||
var lists = ["selectLangs", "proportionalFont"];
|
||||
for( var i = 0; i < lists.length; i++ )
|
||||
{
|
||||
if( !( "dataEls" in dataObject ) )
|
||||
dataObject.dataEls = new Object;
|
||||
dataObject.dataEls[ lists[i] ] = new Object;
|
||||
dataObject.dataEls[ lists[i] ].value = document.getElementById( lists[i] ).value;
|
||||
}
|
||||
if( !( "dataEls" in dataObject ) )
|
||||
dataObject.dataEls = new Object;
|
||||
dataObject.dataEls[ "selectLangs" ] = new Object;
|
||||
dataObject.dataEls[ "selectLangs" ].value = document.getElementById( "selectLangs" ).value;
|
||||
|
||||
dataObject.defaultFont = document.getElementById( "proportionalFont" ).value;
|
||||
dataObject.fontDPI = document.getElementById( "screenResolution" ).value;
|
||||
dataObject.useMyFonts = document.getElementById( "useMyFonts" ).checked ? 1 : 0;
|
||||
|
||||
var items = ["foregroundText", "background", "unvisitedLinks", "visitedLinks", "browserUseSystemColors", "browserUnderlineAnchors", "useMyColors", "useMyFonts"];
|
||||
for (i = 0; i < items.length; ++i)
|
||||
dataObject.dataEls[items[i]] = new Object;
|
||||
dataObject.dataEls["foregroundText"].value = document.getElementById("foregroundtextmenu").color;
|
||||
dataObject.dataEls["background"].value = document.getElementById("backgroundmenu").color;
|
||||
dataObject.dataEls["unvisitedLinks"].value = document.getElementById("unvisitedlinkmenu").color;
|
||||
dataObject.dataEls["visitedLinks"].value = document.getElementById("visitedlinkmenu").color;
|
||||
dataObject.fontDPI = document.getElementById( "screenResolution" ).value;
|
||||
dataObject.useMyFonts = document.getElementById( "useMyFonts" ).checked ? 1 : 0;
|
||||
|
||||
dataObject.dataEls["browserUseSystemColors"].checked = document.getElementById("browserUseSystemColors").checked;
|
||||
dataObject.dataEls["browserUnderlineAnchors"].checked = document.getElementById("browserUnderlineAnchors").checked;
|
||||
dataObject.dataEls["useMyColors"].checked = document.getElementById("useMyColors").checked;
|
||||
dataObject.dataEls["useMyFonts"].checked = document.getElementById("useMyFonts").checked;
|
||||
var items = ["foregroundText", "background", "unvisitedLinks", "visitedLinks", "browserUseSystemColors", "browserUnderlineAnchors", "useMyColors", "useMyFonts"];
|
||||
for (i = 0; i < items.length; ++i)
|
||||
dataObject.dataEls[items[i]] = new Object;
|
||||
dataObject.dataEls["foregroundText"].value = document.getElementById("foregroundtextmenu").color;
|
||||
dataObject.dataEls["background"].value = document.getElementById("backgroundmenu").color;
|
||||
dataObject.dataEls["unvisitedLinks"].value = document.getElementById("unvisitedlinkmenu").color;
|
||||
dataObject.dataEls["visitedLinks"].value = document.getElementById("visitedlinkmenu").color;
|
||||
|
||||
dataObject.dataEls["browserUseSystemColors"].checked = document.getElementById("browserUseSystemColors").checked;
|
||||
dataObject.dataEls["browserUnderlineAnchors"].checked = document.getElementById("browserUnderlineAnchors").checked;
|
||||
dataObject.dataEls["useMyColors"].checked = document.getElementById("useMyColors").checked;
|
||||
dataObject.dataEls["useMyFonts"].checked = document.getElementById("useMyFonts").checked;
|
||||
|
||||
// save current state for language dependent fields and store
|
||||
saveState();
|
||||
|
@ -100,25 +95,19 @@ function SetFields(aDataObject)
|
|||
languageData = "languageData" in aDataObject ? aDataObject.languageData : languageData ;
|
||||
currentLanguage = "currentLanguage" in aDataObject ? aDataObject.currentLanguage : null ;
|
||||
|
||||
var lists = ["selectLangs", "proportionalFont"];
|
||||
var prefvalue;
|
||||
|
||||
for( var i = 0; i < lists.length; i++ )
|
||||
var element = document.getElementById( "selectLangs" );
|
||||
if( "dataEls" in aDataObject )
|
||||
{
|
||||
var element = document.getElementById( lists[i] );
|
||||
if( "dataEls" in aDataObject )
|
||||
element.selectedItem = element.getElementsByAttribute( "value", aDataObject.dataEls[ "selectLangs" ].value )[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefstring = element.getAttribute( "prefstring" );
|
||||
var preftype = element.getAttribute( "preftype" );
|
||||
if( prefstring && preftype )
|
||||
{
|
||||
element.selectedItem = element.getElementsByAttribute( "value", aDataObject.dataEls[ lists[i] ].value )[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefstring = element.getAttribute( "prefstring" );
|
||||
var preftype = element.getAttribute( "preftype" );
|
||||
if( prefstring && preftype )
|
||||
{
|
||||
prefvalue = gPrefWindow.getPref( preftype, prefstring );
|
||||
element.selectedItem = element.getElementsByAttribute( "value", prefvalue )[0];
|
||||
}
|
||||
var prefvalue = gPrefWindow.getPref( preftype, prefstring );
|
||||
element.selectedItem = element.getElementsByAttribute( "value", prefvalue )[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,6 +177,7 @@ function SetFields(aDataObject)
|
|||
function Startup()
|
||||
{
|
||||
// Initialize the sub-dialog
|
||||
defaultFont = document.getElementById( "proportionalFont" );
|
||||
variableSize = document.getElementById( "sizeVar" );
|
||||
fixedSize = document.getElementById( "sizeMono" );
|
||||
minSize = document.getElementById( "minSize" );
|
||||
|
@ -466,6 +456,7 @@ function saveState()
|
|||
if( currentLanguage && currentLanguage in languageData &&
|
||||
"types" in languageData[currentLanguage] )
|
||||
{
|
||||
languageData[currentLanguage].defaultFont = defaultFont.value;
|
||||
languageData[currentLanguage].variableSize = parseInt( variableSize.value );
|
||||
languageData[currentLanguage].fixedSize = parseInt( fixedSize.value );
|
||||
languageData[currentLanguage].minSize = parseInt( minSize.value );
|
||||
|
@ -511,23 +502,26 @@ function selectLanguage()
|
|||
listElement.setAttribute( "disabled", "true" );
|
||||
}
|
||||
|
||||
// and set the font sizes
|
||||
// and set the default font type and the font sizes
|
||||
var dataObject = gPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-fonts.xul"].userData;
|
||||
var langData = null;
|
||||
try
|
||||
{
|
||||
var sizeVarVal, sizeFixedVal;
|
||||
var defaultFontVal, sizeVarVal, sizeFixedVal;
|
||||
if ('languageData' in dataObject) {
|
||||
langData = dataObject.languageData[currentLanguage];
|
||||
defaultFontVal = langData.defaultFont;
|
||||
sizeVarVal = langData.variableSize;
|
||||
sizeFixedVal = langData.fixedSize;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
defaultFontVal = gPrefWindow.getPref("string", "font.default." + languageList.value);
|
||||
var variableSizePref = "font.size.variable." + languageList.value;
|
||||
sizeVarVal = gPrefWindow.pref.GetIntPref( variableSizePref );
|
||||
var fixedSizePref = "font.size.fixed." + languageList.value;
|
||||
sizeFixedVal = gPrefWindow.pref.GetIntPref( fixedSizePref );
|
||||
}
|
||||
defaultFont.value = defaultFontVal;
|
||||
variableSize.selectedItem = variableSize.getElementsByAttribute( "value", sizeVarVal )[0];
|
||||
fixedSize.selectedItem = fixedSize.getElementsByAttribute( "value", sizeFixedVal )[0];
|
||||
}
|
||||
|
|
|
@ -107,8 +107,7 @@
|
|||
accesskey="&proportional.accesskey;"
|
||||
control="proportionalFont"/>
|
||||
</hbox>
|
||||
<menulist id="proportionalFont" flex="1" style="width: 0px;"
|
||||
preftype="string" prefstring="font.default">
|
||||
<menulist id="proportionalFont" flex="1" style="width: 0px;">
|
||||
<menupopup>
|
||||
<menuitem value="serif"
|
||||
label="&useDefaultFontSerif.label;"/>
|
||||
|
|
|
@ -1,252 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Firefox Options Dialog
|
||||
#
|
||||
# The Initial Developer of the Original Code is mozilla.org.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
var _elementIDs = ["browserStartupHomepage", "checkForDefault"];
|
||||
|
||||
const nsIPrefService = Components.interfaces.nsIPrefService;
|
||||
const nsIPrefLocalizedString = Components.interfaces.nsIPrefLocalizedString;
|
||||
|
||||
const PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1";
|
||||
|
||||
function setHomePageToCurrentPage()
|
||||
{
|
||||
if (top.opener) {
|
||||
var homePageField = document.getElementById("browserStartupHomepage");
|
||||
var newVal = "";
|
||||
|
||||
var tabbrowser = top.opener.document.getElementById("content");
|
||||
var l = tabbrowser.browsers.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (i)
|
||||
newVal += "|";
|
||||
newVal += tabbrowser.getBrowserAtIndex(i).webNavigation.currentURI.spec;
|
||||
}
|
||||
|
||||
homePageField.value = newVal;
|
||||
}
|
||||
}
|
||||
|
||||
function setHomePageToBookmark()
|
||||
{
|
||||
var rv = { url: null };
|
||||
openDialog("chrome://browser/content/bookmarks/selectBookmark.xul", "",
|
||||
"centerscreen,chrome,modal=yes,dialog=yes,resizable=yes", rv);
|
||||
if (rv.url) {
|
||||
var homePageField = document.getElementById("browserStartupHomepage");
|
||||
homePageField.value = rv.url;
|
||||
}
|
||||
}
|
||||
|
||||
function setHomePageToDefaultPage()
|
||||
{
|
||||
var prefService = Components.classes[PREFSERVICE_CONTRACTID]
|
||||
.getService(nsIPrefService);
|
||||
var pref = prefService.getDefaultBranch(null);
|
||||
var url = pref.getComplexValue("browser.startup.homepage",
|
||||
nsIPrefLocalizedString).data;
|
||||
var homePageField = document.getElementById("browserStartupHomepage");
|
||||
homePageField.value = url;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
if (!('homepage' in parent))
|
||||
return;
|
||||
|
||||
// Replace pipes with commas to look nicer.
|
||||
parent.homepage = parent.homepage.replace(/\|/g,', ');
|
||||
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||
var eb = windowManagerInterface.getEnumerator("navigator:browser");
|
||||
while (eb.hasMoreElements()) {
|
||||
// Update the home button tooltip.
|
||||
var domWin = eb.getNext().QueryInterface(Components.interfaces.nsIDOMWindow);
|
||||
var homeButton = domWin.document.getElementById("home-button");
|
||||
if (homeButton)
|
||||
homeButton.setAttribute("tooltiptext", parent.homepage);
|
||||
}
|
||||
}
|
||||
|
||||
function Startup()
|
||||
{
|
||||
var useButton = document.getElementById("browserUseCurrent");
|
||||
|
||||
try {
|
||||
var browser = top.opener.document.getElementById("content");
|
||||
|
||||
var l = browser.mPanelContainer.childNodes.length;
|
||||
if (l > 1)
|
||||
useButton.label = useButton.getAttribute("label2");
|
||||
} catch (e) {
|
||||
// prefwindow wasn't opened from a browser window, so no current page
|
||||
useButton.disabled = true;
|
||||
}
|
||||
|
||||
if (parent.hPrefWindow.getPrefIsLocked("browser.startup.homepage")) {
|
||||
document.getElementById("browserUseCurrent").disabled = true;
|
||||
document.getElementById("browserUseBookmark").disabled = true;
|
||||
document.getElementById("browserUseBlank").disabled = true;
|
||||
}
|
||||
|
||||
try {
|
||||
var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
|
||||
.getService(Components.interfaces.nsIShellService);
|
||||
} catch (e) {
|
||||
document.getElementById("defaultBrowserPrefs").hidden = true;
|
||||
}
|
||||
|
||||
parent.hPrefWindow.registerOKCallbackFunc(onOK);
|
||||
}
|
||||
|
||||
function showConnections()
|
||||
{
|
||||
openDialog("chrome://browser/content/pref/pref-connection.xul", "", "centerscreen,chrome,modal=yes,dialog=yes");
|
||||
}
|
||||
|
||||
function showFontsAndColors()
|
||||
{
|
||||
openDialog("chrome://browser/content/pref/pref-fonts.xul", "", "centerscreen,chrome,modal=yes,dialog=yes");
|
||||
}
|
||||
|
||||
function saveFontPrefs()
|
||||
{
|
||||
var dataObject = top.hPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-fonts.xul"].userData;
|
||||
var pref = top.hPrefWindow.pref;
|
||||
for (var language in dataObject.languageData) {
|
||||
for (var type in dataObject.languageData[language].types) {
|
||||
var fontPrefString = "font.name." + type + "." + language;
|
||||
var currValue = "";
|
||||
try {
|
||||
currValue = pref.CopyUnicharPref(fontPrefString);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
if (currValue != dataObject.languageData[language].types[type])
|
||||
pref.SetUnicharPref(fontPrefString, dataObject.languageData[language].types[type]);
|
||||
}
|
||||
var variableSizePref = "font.size.variable." + language;
|
||||
var fixedSizePref = "font.size.fixed." + language;
|
||||
var minSizePref = "font.minimum-size." + language;
|
||||
var currVariableSize = 12, currFixedSize = 12, minSizeVal = 0;
|
||||
try {
|
||||
currVariableSize = pref.GetIntPref(variableSizePref);
|
||||
currFixedSize = pref.GetIntPref(fixedSizePref );
|
||||
minSizeVal = pref.GetIntPref(minSizePref);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
if (currVariableSize != dataObject.languageData[language].variableSize)
|
||||
pref.SetIntPref(variableSizePref, dataObject.languageData[language].variableSize);
|
||||
if (currFixedSize != dataObject.languageData[language].fixedSize)
|
||||
pref.SetIntPref(fixedSizePref, dataObject.languageData[language].fixedSize);
|
||||
if (minSizeVal != dataObject.languageData[language].minSize) {
|
||||
pref.SetIntPref(minSizePref, dataObject.languageData[language].minSize);
|
||||
}
|
||||
}
|
||||
|
||||
// font scaling
|
||||
var fontDPI = parseInt(dataObject.fontDPI);
|
||||
var myFonts = dataObject.dataEls["useMyFonts"].checked;
|
||||
var defaultFont = dataObject.defaultFont;
|
||||
var myColors = dataObject.dataEls["useMyColors"].checked;
|
||||
try {
|
||||
var currDPI = pref.GetIntPref("browser.display.screen_resolution");
|
||||
var currFonts = pref.GetIntPref("browser.display.use_document_fonts");
|
||||
var currColors = pref.GetBoolPref("browser.display.use_document_colors");
|
||||
var currDefault = pref.CopyUnicharPref( "font.default" );
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
|
||||
if (currDPI != fontDPI)
|
||||
pref.SetIntPref("browser.display.screen_resolution", fontDPI);
|
||||
if (currFonts == myFonts)
|
||||
pref.SetIntPref("browser.display.use_document_fonts", !myFonts);
|
||||
if(currDefault != defaultFont)
|
||||
pref.SetUnicharPref( "font.default", defaultFont );
|
||||
if (currColors == myColors)
|
||||
pref.SetBoolPref("browser.display.use_document_colors", !myColors);
|
||||
|
||||
var items = ["foregroundText", "background", "unvisitedLinks", "visitedLinks"];
|
||||
var prefs = ["browser.display.foreground_color", "browser.display.background_color",
|
||||
"browser.anchor_color", "browser.visited_color"];
|
||||
var prefvalue;
|
||||
for (var i = 0; i < items.length; ++i) {
|
||||
prefvalue = dataObject.dataEls[items[i]].value;
|
||||
pref.SetUnicharPref(prefs[i], prefvalue)
|
||||
}
|
||||
items = ["browserUseSystemColors", "browserUnderlineAnchors"];
|
||||
prefs = ["browser.display.use_system_colors", "browser.underline_anchors"];
|
||||
for (i = 0; i < items.length; ++i) {
|
||||
prefvalue = dataObject.dataEls[items[i]].checked;
|
||||
pref.SetBoolPref(prefs[i], prefvalue)
|
||||
}
|
||||
}
|
||||
|
||||
# this function is only reached if the shell service is defined
|
||||
function checkNow()
|
||||
{
|
||||
var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
|
||||
.getService(Components.interfaces.nsIShellService);
|
||||
var brandBundle = document.getElementById("bundle_brand");
|
||||
var shellBundle = document.getElementById("bundle_shell");
|
||||
var brandShortName = brandBundle.getString("brandShortName");
|
||||
var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
|
||||
var promptMessage;
|
||||
const IPS = Components.interfaces.nsIPromptService;
|
||||
var psvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(IPS);
|
||||
if (!shellSvc.isDefaultBrowser(false)) {
|
||||
promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage",
|
||||
[brandShortName]);
|
||||
var rv = psvc.confirmEx(window, promptTitle, promptMessage,
|
||||
(IPS.BUTTON_TITLE_YES * IPS.BUTTON_POS_0) +
|
||||
(IPS.BUTTON_TITLE_NO * IPS.BUTTON_POS_1),
|
||||
null, null, null, null, { });
|
||||
if (rv == 0)
|
||||
shellSvc.setDefaultBrowser(true, false);
|
||||
}
|
||||
else {
|
||||
promptMessage = shellBundle.getFormattedString("alreadyDefaultBrowser",
|
||||
[brandShortName]);
|
||||
psvc.alert(window, promptTitle, promptMessage);
|
||||
}
|
||||
}
|
||||
|
||||
function showLanguages()
|
||||
{
|
||||
openDialog("chrome://browser/content/pref/pref-languages.xul", "", "modal,centerscreen,resizable");
|
||||
}
|
|
@ -619,7 +619,7 @@ mozilla_set_pref( PtWidget_t *widget, char *option, char *value )
|
|||
char *font_default = NULL;
|
||||
char preference[256];
|
||||
|
||||
pref->CopyCharPref( "font.default", &font_default );
|
||||
pref->CopyCharPref( "font.default.x-western", &font_default );
|
||||
if( !font_default ) font_default = "serif";
|
||||
|
||||
sprintf( preference, "font.name.%s.x-western", font_default );
|
||||
|
@ -864,7 +864,7 @@ static void mozilla_get_pref( PtWidget_t *widget, char *option, char *value ) {
|
|||
char *font_default = NULL, *font;
|
||||
char preference[256];
|
||||
|
||||
pref->CopyCharPref( "font.default", &font_default );
|
||||
pref->CopyCharPref( "font.default.x-western", &font_default );
|
||||
if( !font_default ) font_default = "serif";
|
||||
|
||||
sprintf( preference, "font.name.%s.x-western", font_default );
|
||||
|
|
|
@ -253,11 +253,11 @@ TranslatePropFont(unsigned char *aRegValue, DWORD aRegValueLength,
|
|||
if (isSerif) {
|
||||
prefs->SetCharPref("font.name.serif.x-western",
|
||||
NS_REINTERPRET_CAST(char *, aRegValue));
|
||||
prefs->SetCharPref("font.default", "serif");
|
||||
prefs->SetCharPref("font.default.x-western", "serif");
|
||||
} else {
|
||||
prefs->SetCharPref("font.name.sans-serif.x-western",
|
||||
NS_REINTERPRET_CAST(char *, aRegValue));
|
||||
prefs->SetCharPref("font.default", "sans-serif");
|
||||
prefs->SetCharPref("font.default.x-western", "sans-serif");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -404,10 +404,14 @@ nsFontMetricsXft::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString value;
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
|
||||
// Set up the default font name if it's not set
|
||||
if (!mGenericFont) {
|
||||
prefService->CopyCharPref("font.default", getter_Copies(value));
|
||||
nsCAutoString name("font.default.");
|
||||
name.Append(langGroup);
|
||||
prefService->CopyCharPref(name.get(), getter_Copies(value));
|
||||
|
||||
if (value.get())
|
||||
mDefaultFont = value.get();
|
||||
|
@ -427,10 +431,6 @@ nsFontMetricsXft::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
name.Append("variable");
|
||||
|
||||
name.Append(char('.'));
|
||||
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
|
||||
name.Append(langGroup);
|
||||
|
||||
PRInt32 minimum = 0;
|
||||
|
|
|
@ -1626,8 +1626,12 @@ NS_IMETHODIMP nsFontMetricsGTK::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
|
||||
mFont.EnumerateFamilies(FontEnumCallback, this);
|
||||
nsXPIDLCString value;
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
if (!mGeneric) {
|
||||
gPref->CopyCharPref("font.default", getter_Copies(value));
|
||||
nsCAutoString name("font.default.");
|
||||
name.Append(langGroup);
|
||||
gPref->CopyCharPref(name.get(), getter_Copies(value));
|
||||
if (value.get()) {
|
||||
mDefaultFont = value.get();
|
||||
}
|
||||
|
@ -1646,8 +1650,6 @@ NS_IMETHODIMP nsFontMetricsGTK::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
name.Append("variable");
|
||||
}
|
||||
name.Append(char('.'));
|
||||
const char* langGroup = nsnull;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
name.Append(langGroup);
|
||||
PRInt32 minimum = 0;
|
||||
res = gPref->GetIntPref(name.get(), &minimum);
|
||||
|
@ -6743,4 +6745,3 @@ CharSetNameToCodeRangeBits(const char *aCharset,
|
|||
*aCodeRange2 = charSetInfo->mCodeRange2Bits;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -208,10 +208,14 @@ nsFontMetricsPango::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString value;
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
|
||||
// Set up the default font name if it's not set
|
||||
if (!mGenericFont) {
|
||||
prefService->CopyCharPref("font.default", getter_Copies(value));
|
||||
nsCAutoString name("font.default.");
|
||||
name.Append(langGroup);
|
||||
prefService->CopyCharPref(name.get(), getter_Copies(value));
|
||||
|
||||
if (value.get())
|
||||
mDefaultFont = value.get();
|
||||
|
@ -231,10 +235,6 @@ nsFontMetricsPango::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
name.Append("variable");
|
||||
|
||||
name.Append(char('.'));
|
||||
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
|
||||
name.Append(langGroup);
|
||||
|
||||
PRInt32 minimumInt = 0;
|
||||
|
|
|
@ -376,10 +376,14 @@ nsFontMetricsXft::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString value;
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
|
||||
// Set up the default font name if it's not set
|
||||
if (!mGenericFont) {
|
||||
prefService->CopyCharPref("font.default", getter_Copies(value));
|
||||
nsCAutoString name("font.default.");
|
||||
name.Append(langGroup);
|
||||
prefService->CopyCharPref(name.get(), getter_Copies(value));
|
||||
|
||||
if (value.get())
|
||||
mDefaultFont = value.get();
|
||||
|
@ -399,10 +403,6 @@ nsFontMetricsXft::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
name.Append("variable");
|
||||
|
||||
name.Append(char('.'));
|
||||
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
|
||||
name.Append(langGroup);
|
||||
|
||||
PRInt32 minimum = 0;
|
||||
|
|
|
@ -1343,7 +1343,11 @@ nsFontMetricsOS2::RealizeFont()
|
|||
|
||||
// set a fallback generic font if the font-family list didn't have one
|
||||
if (mGeneric.IsEmpty()) {
|
||||
rv = gPref->CopyUnicharPref("font.default", getter_Copies(value));
|
||||
const char* langGroup = nsnull;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
pref.Assign("font.default.");
|
||||
pref.Append(langGroup);
|
||||
rv = gPref->CopyUnicharPref(pref.get(), getter_Copies(value));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mGeneric.Assign(value);
|
||||
}
|
||||
|
|
|
@ -875,9 +875,14 @@ nsFontPSXft::FindFont(PRUnichar aChar, const nsFont& aFont,
|
|||
nsXPIDLCString value;
|
||||
nsCAutoString defaultFont;
|
||||
|
||||
nsAutoString langGroupStr;
|
||||
langGroup->ToString(langGroupStr);
|
||||
|
||||
// Set up the default font name if it's not set
|
||||
if (!fpi.mGenericFont) {
|
||||
prefService->CopyCharPref("font.default", getter_Copies(value));
|
||||
nsCAutoString name("font.default.");
|
||||
LossyAppendUTF16toASCII(langGroupStr, name);
|
||||
prefService->CopyCharPref(name.get(), getter_Copies(value));
|
||||
|
||||
if (value.get())
|
||||
defaultFont = value.get();
|
||||
|
@ -1483,11 +1488,13 @@ nsFontPSFreeType::AddUserPref(nsIAtom *aLang, const nsFont& aFont,
|
|||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
nsXPIDLCString value;
|
||||
pref->CopyCharPref("font.default", getter_Copies(value));
|
||||
nsCAutoString name("font.default.");
|
||||
name.Append(fpi->lang);
|
||||
pref->CopyCharPref(name.get(), getter_Copies(value));
|
||||
if (!value.get())
|
||||
return PR_FALSE;
|
||||
|
||||
nsCAutoString name("font.name.");
|
||||
name.Assign("font.name.");
|
||||
name.Append(value);
|
||||
name.Append(char('.'));
|
||||
name.Append(fpi->lang);
|
||||
|
|
|
@ -3557,7 +3557,11 @@ nsFontMetricsWin::RealizeFont()
|
|||
|
||||
// set a fallback generic font if the font-family list didn't have one
|
||||
if (mGeneric.IsEmpty()) {
|
||||
rv = gPref->CopyUnicharPref("font.default", getter_Copies(value));
|
||||
pref.Assign("font.default.");
|
||||
const char* langGroup;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
pref.Append(langGroup);
|
||||
rv = gPref->CopyUnicharPref(pref.get(), getter_Copies(value));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mGeneric.Assign(value);
|
||||
}
|
||||
|
|
|
@ -1975,8 +1975,12 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
|
||||
mFont.EnumerateFamilies(FontEnumCallback, this);
|
||||
nsXPIDLCString value;
|
||||
const char* langGroup = nsnull;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
if (!mGeneric) {
|
||||
mFontMetricsContext->mPref->CopyCharPref("font.default", getter_Copies(value));
|
||||
nsCAutoString name("font.default.");
|
||||
name.Append(langGroup);
|
||||
mFontMetricsContext->mPref->CopyCharPref(name.get(), getter_Copies(value));
|
||||
if (value.get()) {
|
||||
mDefaultFont = value.get();
|
||||
}
|
||||
|
@ -1995,8 +1999,6 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
name.Append("variable");
|
||||
}
|
||||
name.Append(char('.'));
|
||||
const char* langGroup = nsnull;
|
||||
mLangGroup->GetUTF8String(&langGroup);
|
||||
name.Append(langGroup);
|
||||
PRInt32 minimum = 0;
|
||||
res = mFontMetricsContext->mPref->GetIntPref(name.get(), &minimum);
|
||||
|
@ -6051,4 +6053,3 @@ void CharSetNameToCodeRangeBits(const char *aCharset,
|
|||
*aCodeRange2 = charSetInfo->mCodeRange2Bits;
|
||||
}
|
||||
#endif /* MOZ_ENABLE_FREETYPE2 */
|
||||
|
||||
|
|
|
@ -366,7 +366,8 @@ nsPresContext::GetFontPreferences()
|
|||
font->name.Assign(value);
|
||||
}
|
||||
else {
|
||||
value = nsContentUtils::GetStringPref("font.default");
|
||||
MAKE_FONT_PREF_KEY(pref, "font.default.", langGroup);
|
||||
value = nsContentUtils::GetStringPref(pref.get());
|
||||
if (!value.IsEmpty()) {
|
||||
mDefaultVariableFont.name.Assign(value);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ catch(e)
|
|||
var fontEnumerator = null;
|
||||
var globalFonts = null;
|
||||
var fontTypes = ["serif", "sans-serif", "monospace"];
|
||||
var variableSize, fixedSize, minSize, languageList;
|
||||
var defaultFont, variableSize, fixedSize, minSize, languageList;
|
||||
var languageData = [];
|
||||
var currentLanguage;
|
||||
var gPrefutilitiesBundle;
|
||||
|
@ -60,16 +60,11 @@ function GetFields()
|
|||
var dataObject = parent.hPrefWindow.wsm.dataManager.pageData["chrome://communicator/content/pref/pref-fonts.xul"];
|
||||
|
||||
// store data for language independent widgets
|
||||
var lists = ["selectLangs", "proportionalFont"];
|
||||
for( var i = 0; i < lists.length; i++ )
|
||||
{
|
||||
if( !( "dataEls" in dataObject ) )
|
||||
dataObject.dataEls = [];
|
||||
dataObject.dataEls[ lists[i] ] = [];
|
||||
dataObject.dataEls[ lists[i] ].value = document.getElementById( lists[i] ).value;
|
||||
}
|
||||
if( !( "dataEls" in dataObject ) )
|
||||
dataObject.dataEls = [];
|
||||
dataObject.dataEls[ "selectLangs" ] = [];
|
||||
dataObject.dataEls[ "selectLangs" ].value = document.getElementById( "selectLangs" ).value;
|
||||
|
||||
dataObject.defaultFont = document.getElementById( "proportionalFont" ).value;
|
||||
dataObject.fontDPI = document.getElementById( "screenResolution" ).value;
|
||||
dataObject.useDocFonts = document.getElementById( "browserUseDocumentFonts" ).checked ? 1 : 0;
|
||||
|
||||
|
@ -86,25 +81,19 @@ function SetFields( aDataObject )
|
|||
languageData = "languageData" in aDataObject ? aDataObject.languageData : languageData ;
|
||||
currentLanguage = "currentLanguage" in aDataObject ? aDataObject.currentLanguage : null ;
|
||||
|
||||
var lists = ["selectLangs", "proportionalFont"];
|
||||
var prefvalue;
|
||||
|
||||
for( var i = 0; i < lists.length; i++ )
|
||||
var element = document.getElementById( "selectLangs" );
|
||||
if( "dataEls" in aDataObject )
|
||||
{
|
||||
var element = document.getElementById( lists[i] );
|
||||
if( "dataEls" in aDataObject )
|
||||
element.selectedItem = element.getElementsByAttribute( "value", aDataObject.dataEls[ "selectLangs" ].value )[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefstring = element.getAttribute( "prefstring" );
|
||||
var preftype = element.getAttribute( "preftype" );
|
||||
if( prefstring && preftype )
|
||||
{
|
||||
element.selectedItem = element.getElementsByAttribute( "value", aDataObject.dataEls[ lists[i] ].value )[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefstring = element.getAttribute( "prefstring" );
|
||||
var preftype = element.getAttribute( "preftype" );
|
||||
if( prefstring && preftype )
|
||||
{
|
||||
prefvalue = parent.hPrefWindow.getPref( preftype, prefstring );
|
||||
element.selectedItem = element.getElementsByAttribute( "value", prefvalue )[0];
|
||||
}
|
||||
var prefvalue = parent.hPrefWindow.getPref( preftype, prefstring );
|
||||
element.selectedItem = element.getElementsByAttribute( "value", prefvalue )[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,6 +137,7 @@ function SetFields( aDataObject )
|
|||
|
||||
function Startup()
|
||||
{
|
||||
defaultFont = document.getElementById( "proportionalFont" );
|
||||
variableSize = document.getElementById( "sizeVar" );
|
||||
fixedSize = document.getElementById( "sizeMono" );
|
||||
minSize = document.getElementById( "minSize" );
|
||||
|
@ -458,12 +448,14 @@ function saveFontPrefs()
|
|||
}
|
||||
}
|
||||
}
|
||||
var defaultFontPref = "font.default." + language;
|
||||
var variableSizePref = "font.size.variable." + language;
|
||||
var fixedSizePref = "font.size.fixed." + language;
|
||||
var minSizePref = "font.minimum-size." + language;
|
||||
var currVariableSize = 12, currFixedSize = 12, minSizeVal = 0;
|
||||
var currDefaultFont = "serif", currVariableSize = 12, currFixedSize = 12, minSizeVal = 0;
|
||||
try
|
||||
{
|
||||
currDefaultFont = pref.CopyUnicharPref( defaultFontPref );
|
||||
currVariableSize = pref.GetIntPref( variableSizePref );
|
||||
currFixedSize = pref.GetIntPref( fixedSizePref );
|
||||
minSizeVal = pref.GetIntPref( minSizePref );
|
||||
|
@ -471,11 +463,13 @@ function saveFontPrefs()
|
|||
catch(e)
|
||||
{
|
||||
}
|
||||
if( currDefaultFont != dataObject.languageData[language].defaultFont )
|
||||
pref.SetUnicharPref( defaultFontPref, dataObject.languageData[language].defaultFont );
|
||||
if( currVariableSize != dataObject.languageData[language].variableSize )
|
||||
pref.SetIntPref( variableSizePref, dataObject.languageData[language].variableSize );
|
||||
if( currFixedSize != dataObject.languageData[language].fixedSize )
|
||||
pref.SetIntPref( fixedSizePref, dataObject.languageData[language].fixedSize );
|
||||
if ( minSizeVal != dataObject.languageData[language].minSize ) {
|
||||
if( minSizeVal != dataObject.languageData[language].minSize ) {
|
||||
pref.SetIntPref ( minSizePref, dataObject.languageData[language].minSize );
|
||||
}
|
||||
}
|
||||
|
@ -483,13 +477,11 @@ function saveFontPrefs()
|
|||
// font scaling
|
||||
var fontDPI = parseInt( dataObject.fontDPI );
|
||||
var documentFonts = dataObject.useDocFonts;
|
||||
var defaultFont = dataObject.defaultFont;
|
||||
|
||||
try
|
||||
{
|
||||
var currDPI = pref.GetIntPref( "browser.display.screen_resolution" );
|
||||
var currFonts = pref.GetIntPref( "browser.display.use_document_fonts" );
|
||||
var currDefault = pref.CopyUnicharPref( "font.default" );
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
|
@ -498,10 +490,6 @@ function saveFontPrefs()
|
|||
pref.SetIntPref( "browser.display.screen_resolution", fontDPI );
|
||||
if( currFonts != documentFonts )
|
||||
pref.SetIntPref( "browser.display.use_document_fonts", documentFonts );
|
||||
if( currDefault != defaultFont )
|
||||
{
|
||||
pref.SetUnicharPref( "font.default", defaultFont );
|
||||
}
|
||||
// save off the language information...
|
||||
|
||||
}
|
||||
|
@ -524,6 +512,7 @@ function saveState()
|
|||
if( currentLanguage && currentLanguage in languageData &&
|
||||
"types" in languageData[currentLanguage] )
|
||||
{
|
||||
languageData[currentLanguage].defaultFont = defaultFont.value;
|
||||
languageData[currentLanguage].variableSize = parseInt( variableSize.value );
|
||||
languageData[currentLanguage].fixedSize = parseInt( fixedSize.value );
|
||||
languageData[currentLanguage].minSize = parseInt( minSize.value );
|
||||
|
@ -569,9 +558,11 @@ function selectLanguage()
|
|||
listElement.setAttribute( "disabled", "true" );
|
||||
}
|
||||
|
||||
// and set the font sizes
|
||||
// and set the default font type and the font sizes
|
||||
try
|
||||
{
|
||||
defaultFont.value = parent.hPrefWindow.getPref("string", "font.default." + languageList.value);
|
||||
|
||||
var variableSizePref = "font.size.variable." + languageList.value;
|
||||
var sizeVarVal = parent.hPrefWindow.pref.GetIntPref( variableSizePref );
|
||||
variableSize.selectedItem = variableSize.getElementsByAttribute( "value", sizeVarVal )[0];
|
||||
|
|
|
@ -90,8 +90,7 @@
|
|||
accesskey="&proportional.accesskey;"
|
||||
control="proportionalFont"/>
|
||||
</hbox>
|
||||
<menulist id="proportionalFont"
|
||||
preftype="string" prefstring="font.default">
|
||||
<menulist id="proportionalFont">
|
||||
<menupopup>
|
||||
<menuitem value="serif"
|
||||
label="&useDefaultFontSerif.label;"/>
|
||||
|
|
|
@ -973,55 +973,71 @@ pref("font.name.monospace.x-tamil", "Latha");
|
|||
pref("font.name-list.serif.x-tamil", "Latha, Code2000");
|
||||
pref("font.name-list.monospace.x-tamil", "Latha, Code2000");
|
||||
|
||||
pref("font.default", "serif");
|
||||
pref("font.default.ar", "sans-serif");
|
||||
pref("font.size.variable.ar", 16);
|
||||
pref("font.size.fixed.ar", 13);
|
||||
|
||||
pref("font.default.el", "serif");
|
||||
pref("font.size.variable.el", 16);
|
||||
pref("font.size.fixed.el", 13);
|
||||
|
||||
pref("font.default.he", "sans-serif");
|
||||
pref("font.size.variable.he", 16);
|
||||
pref("font.size.fixed.he", 13);
|
||||
|
||||
pref("font.default.ja", "sans-serif");
|
||||
pref("font.size.variable.ja", 16);
|
||||
pref("font.size.fixed.ja", 16);
|
||||
|
||||
pref("font.default.ko", "sans-serif");
|
||||
pref("font.size.variable.ko", 16);
|
||||
pref("font.size.fixed.ko", 16);
|
||||
|
||||
pref("font.default.th", "serif");
|
||||
pref("font.size.variable.th", 16);
|
||||
pref("font.size.fixed.th", 13);
|
||||
|
||||
pref("font.default.tr", "serif");
|
||||
pref("font.size.variable.tr", 16);
|
||||
pref("font.size.fixed.tr", 13);
|
||||
|
||||
pref("font.default.x-baltic", "serif");
|
||||
pref("font.size.variable.x-baltic", 16);
|
||||
pref("font.size.fixed.x-baltic", 13);
|
||||
|
||||
pref("font.default.x-central-euro", "serif");
|
||||
pref("font.size.variable.x-central-euro", 16);
|
||||
pref("font.size.fixed.x-central-euro", 13);
|
||||
|
||||
pref("font.default.x-cyrillic", "serif");
|
||||
pref("font.size.variable.x-cyrillic", 16);
|
||||
pref("font.size.fixed.x-cyrillic", 13);
|
||||
|
||||
pref("font.default.x-devanagari", "serif");
|
||||
pref("font.size.variable.x-devanagari", 16);
|
||||
pref("font.size.fixed.x-devanagari", 13);
|
||||
|
||||
pref("font.default.x-tamil", "serif");
|
||||
pref("font.size.variable.x-tamil", 16);
|
||||
pref("font.size.fixed.x-tamil", 13);
|
||||
|
||||
pref("font.default.x-unicode", "serif");
|
||||
pref("font.size.variable.x-unicode", 16);
|
||||
pref("font.size.fixed.x-unicode", 13);
|
||||
|
||||
pref("font.default.x-western", "serif");
|
||||
pref("font.size.variable.x-western", 16);
|
||||
pref("font.size.fixed.x-western", 13);
|
||||
|
||||
pref("font.default.zh-CN", "sans-serif");
|
||||
pref("font.size.variable.zh-CN", 16);
|
||||
pref("font.size.fixed.zh-CN", 16);
|
||||
|
||||
pref("font.default.zh-TW", "sans-serif");
|
||||
pref("font.size.variable.zh-TW", 16);
|
||||
pref("font.size.fixed.zh-TW", 16);
|
||||
|
||||
pref("font.default.zh-HK", "sans-serif");
|
||||
pref("font.size.variable.zh-HK", 16);
|
||||
pref("font.size.fixed.zh-HK", 16);
|
||||
|
||||
|
@ -1180,49 +1196,63 @@ pref("font.name.monospace.zh-HK", "Apple LiGothic Medium");
|
|||
pref("font.name.cursive.zh-HK", "XXX.cursive");
|
||||
pref("font.name.fantasy.zh-HK", "XXX.fantasy");
|
||||
|
||||
pref("font.default", "serif");
|
||||
pref("font.default.ar", "sans-serif");
|
||||
pref("font.size.variable.ar", 15);
|
||||
pref("font.size.fixed.ar", 13);
|
||||
|
||||
pref("font.default.el", "serif");
|
||||
pref("font.size.variable.el", 16);
|
||||
pref("font.size.fixed.el", 13);
|
||||
|
||||
pref("font.default.he", "sans-serif");
|
||||
pref("font.size.variable.he", 15);
|
||||
pref("font.size.fixed.he", 13);
|
||||
|
||||
pref("font.default.ja", "sans-serif");
|
||||
pref("font.size.variable.ja", 14);
|
||||
pref("font.size.fixed.ja", 14);
|
||||
|
||||
pref("font.default.ko", "sans-serif");
|
||||
pref("font.size.variable.ko", 16);
|
||||
pref("font.size.fixed.ko", 16);
|
||||
|
||||
pref("font.default.th", "serif");
|
||||
pref("font.size.variable.th", 16);
|
||||
pref("font.size.fixed.th", 13);
|
||||
|
||||
pref("font.default.tr", "serif");
|
||||
pref("font.size.variable.tr", 16);
|
||||
pref("font.size.fixed.tr", 13);
|
||||
|
||||
pref("font.default.x-baltic", "serif");
|
||||
pref("font.size.variable.x-baltic", 16);
|
||||
pref("font.size.fixed.x-baltic", 13);
|
||||
|
||||
pref("font.default.x-central-euro", "serif");
|
||||
pref("font.size.variable.x-central-euro", 16);
|
||||
pref("font.size.fixed.x-central-euro", 13);
|
||||
|
||||
pref("font.default.x-cyrillic", "serif");
|
||||
pref("font.size.variable.x-cyrillic", 16);
|
||||
pref("font.size.fixed.x-cyrillic", 13);
|
||||
|
||||
pref("font.default.x-unicode", "serif");
|
||||
pref("font.size.variable.x-unicode", 16);
|
||||
pref("font.size.fixed.x-unicode", 13);
|
||||
|
||||
pref("font.default.x-western", "serif");
|
||||
pref("font.size.variable.x-western", 16);
|
||||
pref("font.size.fixed.x-western", 13);
|
||||
|
||||
pref("font.default.zh-CN", "sans-serif");
|
||||
pref("font.size.variable.zh-CN", 15);
|
||||
pref("font.size.fixed.zh-CN", 16);
|
||||
|
||||
pref("font.default.zh-TW", "sans-serif");
|
||||
pref("font.size.variable.zh-TW", 15);
|
||||
pref("font.size.fixed.zh-TW", 16);
|
||||
|
||||
pref("font.default.zh-HK", "sans-serif");
|
||||
pref("font.size.variable.zh-HK", 15);
|
||||
pref("font.size.fixed.zh-HK", 16);
|
||||
|
||||
|
@ -1339,48 +1369,72 @@ pref("font.name.sans-serif.zh-HK", "Helv");
|
|||
pref("font.name.monospace.zh-HK", "Courier");
|
||||
|
||||
pref("font.default", "serif");
|
||||
|
||||
pref("font.default.ar", "sans-serif");
|
||||
pref("font.size.variable.ar", 16);
|
||||
pref("font.size.fixed.ar", 13);
|
||||
|
||||
pref("font.default.el", "serif");
|
||||
pref("font.size.variable.el", 16);
|
||||
pref("font.size.fixed.el", 13);
|
||||
|
||||
pref("font.default.he", "sans-serif");
|
||||
pref("font.size.variable.he", 16);
|
||||
pref("font.size.fixed.he", 13);
|
||||
|
||||
pref("font.default.ja", "sans-serif");
|
||||
pref("font.size.variable.ja", 16);
|
||||
pref("font.size.fixed.ja", 16);
|
||||
|
||||
pref("font.default.ko", "sans-serif");
|
||||
pref("font.size.variable.ko", 16);
|
||||
pref("font.size.fixed.ko", 16);
|
||||
|
||||
pref("font.default.th", "serif");
|
||||
pref("font.size.variable.th", 16);
|
||||
pref("font.size.fixed.th", 13);
|
||||
|
||||
pref("font.default.tr", "serif");
|
||||
pref("font.size.variable.tr", 16);
|
||||
pref("font.size.fixed.tr", 13);
|
||||
|
||||
pref("font.default.x-baltic", "serif");
|
||||
pref("font.size.variable.x-baltic", 16);
|
||||
pref("font.size.fixed.x-baltic", 13);
|
||||
|
||||
pref("font.default.x-central-euro", "serif");
|
||||
pref("font.size.variable.x-central-euro", 16);
|
||||
pref("font.size.fixed.x-central-euro", 13);
|
||||
|
||||
pref("font.default.x-cyrillic", "serif");
|
||||
pref("font.size.variable.x-cyrillic", 16);
|
||||
pref("font.size.fixed.x-cyrillic", 13);
|
||||
|
||||
pref("font.default.x-devanagari", "serif");
|
||||
pref("font.size.variable.x-devanagari", 16);
|
||||
pref("font.size.fixed.x-devanagari", 13);
|
||||
|
||||
pref("font.default.x-tamil", "serif");
|
||||
pref("font.size.variable.x-tamil", 16);
|
||||
pref("font.size.fixed.x-tamil", 13);
|
||||
|
||||
pref("font.default.x-unicode", "serif");
|
||||
pref("font.size.variable.x-unicode", 16);
|
||||
pref("font.size.fixed.x-unicode", 13);
|
||||
|
||||
pref("font.default.x-western", "serif");
|
||||
pref("font.size.variable.x-western", 16);
|
||||
pref("font.size.fixed.x-western", 13);
|
||||
|
||||
pref("font.default.zh-CN", "sans-serif");
|
||||
pref("font.size.variable.zh-CN", 16);
|
||||
pref("font.size.fixed.zh-CN", 16);
|
||||
|
||||
pref("font.default.zh-TW", "sans-serif");
|
||||
pref("font.size.variable.zh-TW", 16);
|
||||
pref("font.size.fixed.zh-TW", 16);
|
||||
|
||||
pref("font.default.zh-HK", "sans-serif");
|
||||
pref("font.size.variable.zh-HK", 16);
|
||||
pref("font.size.fixed.zh-HK", 16);
|
||||
|
||||
|
@ -1423,49 +1477,63 @@ pref("intl.font_charset", "");
|
|||
pref("intl.font_spec_list", "");
|
||||
pref("mail.signature_date", 0);
|
||||
|
||||
pref("font.default", "serif");
|
||||
pref("font.default.ar", "sans-serif");
|
||||
pref("font.size.variable.ar", 16);
|
||||
pref("font.size.fixed.ar", 13);
|
||||
|
||||
pref("font.default.el", "serif");
|
||||
pref("font.size.variable.el", 16);
|
||||
pref("font.size.fixed.el", 13);
|
||||
|
||||
pref("font.default.he", "sans-serif");
|
||||
pref("font.size.variable.he", 16);
|
||||
pref("font.size.fixed.he", 13);
|
||||
|
||||
pref("font.default.ja", "sans-serif");
|
||||
pref("font.size.variable.ja", 16);
|
||||
pref("font.size.fixed.ja", 16);
|
||||
|
||||
pref("font.default.ko", "sans-serif");
|
||||
pref("font.size.variable.ko", 16);
|
||||
pref("font.size.fixed.ko", 16);
|
||||
|
||||
pref("font.default.th", "serif");
|
||||
pref("font.size.variable.th", 16);
|
||||
pref("font.size.fixed.th", 13);
|
||||
|
||||
pref("font.default.tr", "serif");
|
||||
pref("font.size.variable.tr", 16);
|
||||
pref("font.size.fixed.tr", 13);
|
||||
|
||||
pref("font.default.x-baltic", "serif");
|
||||
pref("font.size.variable.x-baltic", 16);
|
||||
pref("font.size.fixed.x-baltic", 13);
|
||||
|
||||
pref("font.default.x-central-euro", "serif");
|
||||
pref("font.size.variable.x-central-euro", 16);
|
||||
pref("font.size.fixed.x-central-euro", 13);
|
||||
|
||||
pref("font.default.x-cyrillic", "serif");
|
||||
pref("font.size.variable.x-cyrillic", 16);
|
||||
pref("font.size.fixed.x-cyrillic", 13);
|
||||
|
||||
pref("font.default.x-unicode", "serif");
|
||||
pref("font.size.variable.x-unicode", 16);
|
||||
pref("font.size.fixed.x-unicode", 13);
|
||||
|
||||
pref("font.default.x-western", "serif");
|
||||
pref("font.size.variable.x-western", 16);
|
||||
pref("font.size.fixed.x-western", 13);
|
||||
|
||||
pref("font.default.zh-CN", "sans-serif");
|
||||
pref("font.size.variable.zh-CN", 16);
|
||||
pref("font.size.fixed.zh-CN", 16);
|
||||
|
||||
pref("font.default.zh-TW", "sans-serif");
|
||||
pref("font.size.variable.zh-TW", 16);
|
||||
pref("font.size.fixed.zh-TW", 16);
|
||||
|
||||
pref("font.default.zh-HK", "sans-serif");
|
||||
pref("font.size.variable.zh-HK", 16);
|
||||
pref("font.size.fixed.zh-HK", 16);
|
||||
|
||||
|
@ -1620,49 +1688,63 @@ pref("font.name.monospace.zh-HK", "-arphic-Ming for ISO10646-big5hkscs-0");
|
|||
|
||||
// zh-TW
|
||||
|
||||
pref("font.default", "serif");
|
||||
pref("font.default.ar", "sans-serif");
|
||||
pref("font.size.variable.ar", 16);
|
||||
pref("font.size.fixed.ar", 12);
|
||||
|
||||
pref("font.default.el", "serif");
|
||||
pref("font.size.variable.el", 16);
|
||||
pref("font.size.fixed.el", 12);
|
||||
|
||||
pref("font.default.he", "sans-serif");
|
||||
pref("font.size.variable.he", 16);
|
||||
pref("font.size.fixed.he", 12);
|
||||
|
||||
pref("font.default.ja", "sans-serif");
|
||||
pref("font.size.variable.ja", 16);
|
||||
pref("font.size.fixed.ja", 16);
|
||||
|
||||
pref("font.default.ko", "sans-serif");
|
||||
pref("font.size.variable.ko", 16);
|
||||
pref("font.size.fixed.ko", 16);
|
||||
|
||||
pref("font.default.th", "serif");
|
||||
pref("font.size.variable.th", 16);
|
||||
pref("font.size.fixed.th", 12);
|
||||
|
||||
pref("font.default.tr", "serif");
|
||||
pref("font.size.variable.tr", 16);
|
||||
pref("font.size.fixed.tr", 12);
|
||||
|
||||
pref("font.default.x-baltic", "serif");
|
||||
pref("font.size.variable.x-baltic", 16);
|
||||
pref("font.size.fixed.x-baltic", 12);
|
||||
|
||||
pref("font.default.x-central-euro", "serif");
|
||||
pref("font.size.variable.x-central-euro", 16);
|
||||
pref("font.size.fixed.x-central-euro", 12);
|
||||
|
||||
pref("font.default.x-cyrillic", "serif");
|
||||
pref("font.size.variable.x-cyrillic", 16);
|
||||
pref("font.size.fixed.x-cyrillic", 12);
|
||||
|
||||
pref("font.default.x-unicode", "serif");
|
||||
pref("font.size.variable.x-unicode", 16);
|
||||
pref("font.size.fixed.x-unicode", 12);
|
||||
|
||||
pref("font.default.x-western", "serif");
|
||||
pref("font.size.variable.x-western", 16);
|
||||
pref("font.size.fixed.x-western", 12);
|
||||
|
||||
pref("font.default.zh-CN", "sans-serif");
|
||||
pref("font.size.variable.zh-CN", 16);
|
||||
pref("font.size.fixed.zh-CN", 16);
|
||||
|
||||
pref("font.default.zh-TW", "sans-serif");
|
||||
pref("font.size.variable.zh-TW", 16);
|
||||
pref("font.size.fixed.zh-TW", 16);
|
||||
|
||||
pref("font.default.zh-HK", "sans-serif");
|
||||
pref("font.size.variable.zh-HK", 16);
|
||||
pref("font.size.fixed.zh-HK", 16);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
var fontEnumerator = null;
|
||||
var globalFonts = null;
|
||||
var fontTypes = ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
|
||||
var variableSize, fixedSize, minSize, languageList;
|
||||
var defaultFont, variableSize, fixedSize, minSize, languageList;
|
||||
var languageData = [];
|
||||
var currentLanguage;
|
||||
var gPrefutilitiesBundle;
|
||||
|
@ -51,18 +51,13 @@ function GetFields()
|
|||
var dataObject = parent.hPrefWindow.wsm.dataManager.pageData["chrome://communicator/content/pref/pref-fonts.xul"];
|
||||
|
||||
// store data for language independent widgets
|
||||
var lists = ["selectLangs", "proportionalFont"];
|
||||
for( var i = 0; i < lists.length; i++ )
|
||||
{
|
||||
if( !( "dataEls" in dataObject ) )
|
||||
dataObject.dataEls = [];
|
||||
dataObject.dataEls[ lists[i] ] = [];
|
||||
dataObject.dataEls[ lists[i] ].value = document.getElementById( lists[i] ).value;
|
||||
}
|
||||
if( !( "dataEls" in dataObject ) )
|
||||
dataObject.dataEls = [];
|
||||
dataObject.dataEls[ "selectLangs" ] = [];
|
||||
dataObject.dataEls[ "selectLangs" ].value = document.getElementById( "selectLangs" ).value;
|
||||
|
||||
dataObject.defaultFont = document.getElementById( "proportionalFont" ).value;
|
||||
dataObject.fontDPI = document.getElementById( "screenResolution" ).value;
|
||||
dataObject.useDocFonts = document.getElementById( "browserUseDocumentFonts" ).checked ? 1 : 0;
|
||||
dataObject.fontDPI = document.getElementById( "screenResolution" ).value;
|
||||
dataObject.useDocFonts = document.getElementById( "browserUseDocumentFonts" ).checked ? 1 : 0;
|
||||
|
||||
// save current state for language dependent fields and store
|
||||
saveState();
|
||||
|
@ -77,25 +72,19 @@ function SetFields( aDataObject )
|
|||
languageData = "languageData" in aDataObject ? aDataObject.languageData : languageData ;
|
||||
currentLanguage = "currentLanguage" in aDataObject ? aDataObject.currentLanguage : null ;
|
||||
|
||||
var lists = ["selectLangs", "proportionalFont"];
|
||||
var prefvalue;
|
||||
|
||||
for( var i = 0; i < lists.length; i++ )
|
||||
var element = document.getElementById( "selectLangs" );
|
||||
if( "dataEls" in aDataObject )
|
||||
{
|
||||
var element = document.getElementById( lists[i] );
|
||||
if( "dataEls" in aDataObject )
|
||||
element.selectedItem = element.getElementsByAttribute( "value", aDataObject.dataEls[ "selectLangs" ].value )[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefstring = element.getAttribute( "prefstring" );
|
||||
var preftype = element.getAttribute( "preftype" );
|
||||
if( prefstring && preftype )
|
||||
{
|
||||
element.selectedItem = element.getElementsByAttribute( "value", aDataObject.dataEls[ lists[i] ].value )[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var prefstring = element.getAttribute( "prefstring" );
|
||||
var preftype = element.getAttribute( "preftype" );
|
||||
if( prefstring && preftype )
|
||||
{
|
||||
prefvalue = parent.hPrefWindow.getPref( preftype, prefstring );
|
||||
element.selectedItem = element.getElementsByAttribute( "value", prefvalue )[0];
|
||||
}
|
||||
var prefvalue = parent.hPrefWindow.getPref( preftype, prefstring );
|
||||
element.selectedItem = element.getElementsByAttribute( "value", prefvalue )[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,6 +126,7 @@ function SetFields( aDataObject )
|
|||
|
||||
function Startup()
|
||||
{
|
||||
defaultFont = document.getElementById( "proportionalFont" );
|
||||
variableSize = document.getElementById( "sizeVar" );
|
||||
fixedSize = document.getElementById( "sizeMono" );
|
||||
minSize = document.getElementById( "minSize" );
|
||||
|
@ -433,12 +423,14 @@ function saveFontPrefs()
|
|||
}
|
||||
}
|
||||
}
|
||||
var defaultFontPref = "font.default." + language;
|
||||
var variableSizePref = "font.size.variable." + language;
|
||||
var fixedSizePref = "font.size.fixed." + language;
|
||||
var minSizePref = "font.minimum-size." + language;
|
||||
var currVariableSize = 12, currFixedSize = 12, minSizeVal = 0;
|
||||
var currDefaultFont = "serif", currVariableSize = 12, currFixedSize = 12, minSizeVal = 0;
|
||||
try
|
||||
{
|
||||
currDefaultFont = parent.hPrefWindow.getPref( "string", defaultFontPref );
|
||||
currVariableSize = pref.getIntPref( variableSizePref );
|
||||
currFixedSize = pref.getIntPref( fixedSizePref );
|
||||
minSizeVal = pref.getIntPref( minSizePref );
|
||||
|
@ -446,11 +438,13 @@ function saveFontPrefs()
|
|||
catch(e)
|
||||
{
|
||||
}
|
||||
if( currDefaultFont != dataObject.languageData[language].defaultFont )
|
||||
parent.hPrefWindow.setPref( "string", defaultFontPref, dataObject.languageData[language].defaultFont );
|
||||
if( currVariableSize != dataObject.languageData[language].variableSize )
|
||||
pref.setIntPref( variableSizePref, dataObject.languageData[language].variableSize );
|
||||
if( currFixedSize != dataObject.languageData[language].fixedSize )
|
||||
pref.setIntPref( fixedSizePref, dataObject.languageData[language].fixedSize );
|
||||
if ( minSizeVal != dataObject.languageData[language].minSize ) {
|
||||
if( minSizeVal != dataObject.languageData[language].minSize ) {
|
||||
pref.setIntPref ( minSizePref, dataObject.languageData[language].minSize );
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +458,6 @@ function saveFontPrefs()
|
|||
{
|
||||
var currDPI = pref.getIntPref( "browser.display.screen_resolution" );
|
||||
var currFonts = pref.getIntPref( "browser.display.use_document_fonts" );
|
||||
var currDefault = pref.getComplexValue( "font.default", Components.interfaces.nsISupportsString ).data;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
|
@ -473,10 +466,6 @@ function saveFontPrefs()
|
|||
pref.setIntPref( "browser.display.screen_resolution", fontDPI );
|
||||
if( currFonts != documentFonts )
|
||||
pref.setIntPref( "browser.display.use_document_fonts", documentFonts );
|
||||
if( currDefault != defaultFont )
|
||||
{
|
||||
parent.hPrefWindow.setPref( "string", "font.default", defaultFont );
|
||||
}
|
||||
}
|
||||
|
||||
function saveState()
|
||||
|
@ -497,6 +486,7 @@ function saveState()
|
|||
if( currentLanguage && currentLanguage in languageData &&
|
||||
"types" in languageData[currentLanguage] )
|
||||
{
|
||||
languageData[currentLanguage].defaultFont = defaultFont.value;
|
||||
languageData[currentLanguage].variableSize = parseInt( variableSize.value );
|
||||
languageData[currentLanguage].fixedSize = parseInt( fixedSize.value );
|
||||
languageData[currentLanguage].minSize = parseInt( minSize.value );
|
||||
|
@ -542,9 +532,11 @@ function selectLanguage()
|
|||
listElement.setAttribute( "disabled", "true" );
|
||||
}
|
||||
|
||||
// and set the font sizes
|
||||
// and set the default font type and the font sizes
|
||||
try
|
||||
{
|
||||
defaultFont.value = parent.hPrefWindow.getPref("string", "font.default." + languageList.value);
|
||||
|
||||
var variableSizePref = "font.size.variable." + languageList.value;
|
||||
var sizeVarVal = parent.hPrefWindow.pref.getIntPref( variableSizePref );
|
||||
variableSize.selectedItem = variableSize.getElementsByAttribute( "value", sizeVarVal )[0];
|
||||
|
|
|
@ -116,8 +116,7 @@
|
|||
accesskey="&proportional.accesskey;"
|
||||
control="proportionalFont"/>
|
||||
</hbox>
|
||||
<menulist id="proportionalFont" flex="1" style="width: 0px;"
|
||||
preftype="string" prefstring="font.default">
|
||||
<menulist id="proportionalFont" flex="1" style="width: 0px;">
|
||||
<menupopup>
|
||||
<menuitem value="serif"
|
||||
label="&useDefaultFontSerif.label;"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче