Remove nsFontList/nsIFontList. b=397813 r+sr+a1.9=pavlov
git-svn-id: svn://10.0.0.236/trunk@237396 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -154,8 +154,7 @@ function getComponentList()
|
||||
"nsIHelperAppLauncherDialog",
|
||||
"nsILocalFile",
|
||||
"nsIObserver",
|
||||
"nsIPrefBranch",
|
||||
"nsIFontList");
|
||||
"nsIPrefBranch");
|
||||
|
||||
for (var m=0; m<serviceinterfacelist.length; m++)
|
||||
checkservice(servicecontractidlist[m], serviceinterfacelist[m]);
|
||||
@@ -318,4 +317,4 @@ displayResults(result);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<title> nsIFontList Interface Test </title>
|
||||
<!-- ***** 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 Mozilla Communicator Test Cases.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1999
|
||||
- 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 ***** -->
|
||||
<!-- Descrpt: nsIFontList Interface Test Case
|
||||
Author: dsirnapalli@netscape.com
|
||||
Revs: 07.26.01 - Created
|
||||
Last Run On: 10.23.01.-->
|
||||
|
||||
<!-- script below is ngdriverspecific -->
|
||||
<script type="text/javascript" src="http://bubblegum/ngdriver/suites/testlib.js">
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
res = "";
|
||||
|
||||
function getBrowserVersion()
|
||||
{
|
||||
|
||||
res = res + "<font color='#CC6600'> NOTE: </font>" + "<br>";
|
||||
res = res + "For the Test Case to run correctly include the following line into your prefs.js file." + "<br>";
|
||||
res = res + 'user_pref("signed.applets.codebase_principal_support", true);' + "<br>";
|
||||
res = res + 'prefs.js can be found at' + '<br>';
|
||||
res = res + 'WINNT:C:\\WINNT\\Profiles\\profileyouareusing\\Application Data\\MfcEmbed\\Profiles\\default\\somefolder.slt\\prefs.js' + '<br>';
|
||||
res = res + 'WIN98:C:\\WINDOWS\\Application Data\\MfcEmbed\\Profiles\\default\\somefolder.slt\\prefs.js' + '<br>';
|
||||
res = res + '<br><hr ALIGN=LEFT SIZE=5 NOSHADE WIDTH="80%">' + '\n';
|
||||
|
||||
res = res + '<b><h3><font color="#CC6600"> Browser Info </font></h3></b>' + '\n';
|
||||
res = res + '<table BORDER COLS=2 WIDTH="70%">' + '\n';
|
||||
res = res + ' <tr>' + '\n';
|
||||
res = res + ' <td WIDTH="30%"><b> App Name: </b></td>' + '\n';
|
||||
res = res + ' <td>' + navigator.appName + '</td>' + '\n';
|
||||
res = res + ' </tr>' + '\n';
|
||||
res = res + ' <tr>' + '\n';
|
||||
res = res + ' <td><b> User Agent: </b></td>' + '\n';
|
||||
res = res + ' <td>' + navigator.userAgent + '</td>' + '\n';
|
||||
res = res + ' </tr>' + '\n';
|
||||
res = res + ' <tr>' + '\n';
|
||||
res = res + ' <td><b> Code Name: </b></td>' + '\n';
|
||||
res = res + ' <td>' + navigator.appCodeName + '</td>' + '\n';
|
||||
res = res + ' </tr>' + '\n';
|
||||
res = res + ' <tr>' + '\n';
|
||||
res = res + ' <td><b> App Version: </b></td>' + '\n';
|
||||
res = res + ' <td>' + navigator.appVersion + '</td>' + '\n';
|
||||
res = res + ' </tr>' + '\n';
|
||||
res = res + ' <tr>' + '\n';
|
||||
res = res + ' <td><b> Language: </b></td>' + '\n';
|
||||
res = res + ' <td>' + navigator.language + '</td>' + '\n';
|
||||
res = res + ' </tr>' + '\n';
|
||||
res = res + ' <tr>' + '\n';
|
||||
res = res + ' <td><b> Platform: </b></td>' + '\n';
|
||||
res = res + ' <td>' + navigator.platform + '</td>' + '\n';
|
||||
res = res + ' </tr>' + '\n';
|
||||
res = res + '</table>' + '\n';
|
||||
res = res + '<br><hr ALIGN=LEFT SIZE=5 NOSHADE WIDTH="80%">' + '\n';
|
||||
|
||||
}
|
||||
|
||||
function getFontList()
|
||||
{
|
||||
try
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
||||
|
||||
var fontListObj = Components.classes["@mozilla.org/gfx/fontlist;1"].createInstance();
|
||||
if (fontListObj)
|
||||
fontListObj = fontListObj.QueryInterface(Components.interfaces.nsIFontList);
|
||||
/*
|
||||
this can be done in a single stmt.
|
||||
var fontListObj = Components.classes["@mozilla.org/gfx/fontlist;1"].
|
||||
createInstance(Components.interfaces.nsIFontList);
|
||||
*/
|
||||
}
|
||||
catch(e) {
|
||||
alert("Exception: " + e);
|
||||
}
|
||||
return fontListObj;
|
||||
}
|
||||
|
||||
function getDescription(groupname)
|
||||
{
|
||||
var descriptivename;
|
||||
if(groupname == "x-western")
|
||||
descriptivename = " (American/Western European)";
|
||||
else if(groupname == "ar")
|
||||
descriptivename = " (Arabic)";
|
||||
else if(groupname == "el")
|
||||
descriptivename = " (Greek)";
|
||||
else if(groupname == "he")
|
||||
descriptivename = " (Hebrew)";
|
||||
else if(groupname == "ja")
|
||||
descriptivename = " (Japanese)";
|
||||
else if(groupname == "ko")
|
||||
descriptivename = " (Korean)";
|
||||
else if(groupname == "th")
|
||||
descriptivename = " (Thai)";
|
||||
else if(groupname == "tr")
|
||||
descriptivename = " (Turkish)";
|
||||
else if(groupname == "x-baltic")
|
||||
descriptivename = " (Baltic)";
|
||||
else if(groupname == "x-central-euro")
|
||||
descriptivename = " (Eastern European)";
|
||||
else if(groupname == "x-cyrillic")
|
||||
descriptivename = " (Russian)";
|
||||
else if(groupname == "zh-CN")
|
||||
descriptivename = " (China)";
|
||||
else if(groupname == "zh-TW")
|
||||
descriptivename = " (Taiwan)";
|
||||
|
||||
return descriptivename;
|
||||
}
|
||||
|
||||
function constructFontList(fontList)
|
||||
{
|
||||
try
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
||||
|
||||
res = res + '<b><h3><font color="#CC6600"> Available Fonts </font></h3></b>' + '\n';
|
||||
for(i=0; i<langgroup.length; i++)
|
||||
{
|
||||
res = res + '<br><b><u>' + langgroup[i] + '</u>' + getDescription(langgroup[i]) + '</b> <br><br>';
|
||||
res = res + '<table BORDER COLS=2 WIDTH="90%">' + '\n';
|
||||
for(j=0; j<fonttype.length; j++)
|
||||
{
|
||||
res = res + '<tr>' + '\n';
|
||||
res = res + '<td WIDTH="20%"><b>' + fonttype[j] + ':' + '</b></td>';
|
||||
res = res + '<td>';
|
||||
|
||||
var tempres = "";
|
||||
var fontEnumerator = fontList.availableFonts(langgroup[i], fonttype[j]);
|
||||
while (fontEnumerator.hasMoreElements())
|
||||
{
|
||||
var fontName = fontEnumerator.getNext();
|
||||
fontName = fontName.QueryInterface(Components.interfaces.nsISupportsString);
|
||||
var fontNameStr = fontName.toString();
|
||||
if (fontEnumerator.hasMoreElements())
|
||||
tempres = tempres + fontNameStr + ", ";
|
||||
else
|
||||
tempres = tempres + fontNameStr;
|
||||
}
|
||||
res = res + tempres;
|
||||
res = res + '</td>';
|
||||
res = res + ' </tr>' + '\n';
|
||||
}
|
||||
res = res + '</table>';
|
||||
}
|
||||
res = res + '<br><hr ALIGN=LEFT SIZE=5 NOSHADE WIDTH="80%">' + '\n';
|
||||
}
|
||||
catch(e) {
|
||||
alert("Exception: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
function displayResults()
|
||||
{
|
||||
document.results.textarea.value = res;
|
||||
if (top.name == "testWindow")
|
||||
{
|
||||
fixSubmit();
|
||||
}
|
||||
else
|
||||
{
|
||||
document.write(document.results.textarea.value);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onLoad="displayResults();">
|
||||
|
||||
<!-- form below is ngdriverspecific -->
|
||||
<form name="results" action="/ngdriver/cgi-bin/writeresults.cgi" method="post">
|
||||
<script type="text/javascript">
|
||||
document.write('<input name="resultsfile" type="hidden" value="' + window.opener.document.resultsform.resultsfile.value + '">');
|
||||
</script>
|
||||
<input type="hidden" name="textarea">
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var langgroup = new Array("x-western", "ar", "el", "he", "ja", "ko",
|
||||
"th", "tr", "x-baltic", "x-central-euro",
|
||||
"x-cyrillic", "zh-CN", "zh-TW");
|
||||
var fonttype = new Array( "serif" , "sans-serif", "cursive",
|
||||
"fantasy", "monospace");
|
||||
getBrowserVersion();
|
||||
var fontList = getFontList();
|
||||
constructFontList(fontList);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -48,7 +48,6 @@ GRE_MODULE = 1
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIFontEnumerator.idl \
|
||||
nsIFontList.idl \
|
||||
nsIScriptableRegion.idl \
|
||||
gfxIFormats.idl \
|
||||
gfxIImageFrame.idl \
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Stell <bstell@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 GPL or the LGPL. 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 ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISimpleEnumerator;
|
||||
|
||||
/**
|
||||
* The nsIFontList interface provides an application the
|
||||
* necessary information so that the user can select the font to use
|
||||
* as the default style sheet. This is used if the style sheet is
|
||||
* missing or does not specify a font.
|
||||
* <P>Font lists are specified per language group.
|
||||
*
|
||||
*/
|
||||
|
||||
[scriptable, uuid(702909c6-1dd2-11b2-b833-8a740f643539)]
|
||||
interface nsIFontList : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the list of available fonts for a language group
|
||||
* and for use as the given CSS generic font.
|
||||
*
|
||||
* @param aLangGroup limits the fonts to fonts in a language
|
||||
* group; eg: x-western (American/Western European),
|
||||
* ar (Arabic), el (Greek), he (Hebrew), ja (Japanese),
|
||||
* ko (Korean), th (Thai), tr (Turkish),
|
||||
* x-baltic (Baltic), x-central-euro (Eastern European),
|
||||
* x-cyrillic (Russian), zh-CN (China), zh-TW (Taiwan)
|
||||
*
|
||||
* @param aFontType limits the fonts to the fonts with this CSS
|
||||
* generic font type; eg: serif, sans-serif, cursive,
|
||||
* fantasy, monospace.
|
||||
*
|
||||
* @return a simple enumerator of the available fonts for a
|
||||
* language group / generic type. These strings are
|
||||
* the text supplied by the operating system's font
|
||||
* system.
|
||||
*/
|
||||
nsISimpleEnumerator availableFonts(in wstring aLangGroup,
|
||||
in wstring aFontType);
|
||||
};
|
||||
|
||||
@@ -62,10 +62,6 @@
|
||||
{ 0xa6cf9115, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
#define NS_FONTLIST_CID \
|
||||
{ 0x6a8c0dd4, 0x1dd2, 0x11b2, \
|
||||
{ 0x9a, 0x8f, 0xf8, 0x2f, 0x9d, 0xf2, 0x5b, 0x07 } }
|
||||
|
||||
#define NS_REGION_CID \
|
||||
{ 0xe12752f0, 0xee9a, 0x11d1, \
|
||||
{ 0xa8, 0x2a, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
@@ -82,9 +78,4 @@
|
||||
{ 0x199c7040, 0xcab0, 0x11d2, \
|
||||
{ 0xa8, 0x49, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
|
||||
#define NS_FONTCATALOGSERVICE_CID \
|
||||
{ 0xa3057187, 0xc40f, 0x4ffa, \
|
||||
{ 0x91, 0x60, 0x2b, 0x16, 0x48, 0x20, 0x53, 0xb1 } }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -77,7 +77,6 @@ CPPSRCS = \
|
||||
nsColorNames.cpp \
|
||||
nsDeviceContext.cpp \
|
||||
nsFont.cpp \
|
||||
nsFontList.cpp \
|
||||
nsRect.cpp \
|
||||
nsRegion.cpp \
|
||||
nsTransform2D.cpp \
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "nsScriptableRegion.h"
|
||||
#include "nsDeviceContextBeOS.h"
|
||||
#include "nsImageBeOS.h"
|
||||
#include "nsFontList.h"
|
||||
#include "gfxImageFrame.h"
|
||||
|
||||
// objects that just require generic constructors
|
||||
@@ -58,7 +57,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageBeOS)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionBeOS)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorBeOS)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(gfxImageFrame)
|
||||
|
||||
@@ -146,11 +144,6 @@ static const nsModuleComponentInfo components[] =
|
||||
// "@mozilla.org/gfx/font_enumerator/beos;1",
|
||||
"@mozilla.org/gfx/fontenumerator;1",
|
||||
nsFontEnumeratorBeOSConstructor },
|
||||
{ "Font List",
|
||||
NS_FONTLIST_CID,
|
||||
// "@mozilla.org/gfx/fontlist;1"
|
||||
NS_FONTLIST_CONTRACTID,
|
||||
nsFontListConstructor },
|
||||
{ "windows image frame",
|
||||
GFX_IMAGEFRAME_CID,
|
||||
"@mozilla.org/gfx/image/frame;2",
|
||||
|
||||
@@ -39,9 +39,7 @@
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFontList.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsFontList.h"
|
||||
#include "nsFontMetricsMac.h"
|
||||
#include "nsRenderingContextMac.h"
|
||||
#include "nsImageMac.h"
|
||||
@@ -64,7 +62,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionMac)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDrawingSurfaceMac)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorMac)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(gfxImageFrame)
|
||||
|
||||
static NS_IMETHODIMP
|
||||
@@ -118,10 +115,6 @@ static const nsModuleComponentInfo components[] =
|
||||
NS_FONT_ENUMERATOR_CID,
|
||||
"@mozilla.org/gfx/fontenumerator;1",
|
||||
nsFontEnumeratorMacConstructor },
|
||||
{ "nsFontList",
|
||||
NS_FONTLIST_CID,
|
||||
"@mozilla.org/gfx/fontlist;1",
|
||||
nsFontListConstructor },
|
||||
{ "windows image frame",
|
||||
GFX_IMAGEFRAME_CID,
|
||||
"@mozilla.org/gfx/image/frame;2",
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Stell <bstell@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 GPL or the LGPL. 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 ***** */
|
||||
|
||||
/*
|
||||
* Implementation of nsIFontList
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsFontList.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsDependentString.h"
|
||||
#include "nsIFontEnumerator.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
static NS_DEFINE_IID(kCFontEnumerator, NS_FONT_ENUMERATOR_CID);
|
||||
|
||||
nsFontList::nsFontList()
|
||||
{
|
||||
}
|
||||
|
||||
nsFontList::~nsFontList()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsFontList,nsIFontList)
|
||||
|
||||
/* font list enumerator */
|
||||
class
|
||||
nsFontListEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
nsFontListEnumerator();
|
||||
virtual ~nsFontListEnumerator();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISimpleEnumerator interface
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
|
||||
NS_IMETHOD Init(const PRUnichar *aLangGroup, const PRUnichar *aFontType);
|
||||
|
||||
|
||||
protected:
|
||||
PRUnichar **mFonts;
|
||||
PRUint32 mCount;
|
||||
PRUint32 mIndex;
|
||||
};
|
||||
|
||||
nsFontListEnumerator::nsFontListEnumerator() :
|
||||
mFonts(nsnull), mCount(0), mIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
nsFontListEnumerator::~nsFontListEnumerator()
|
||||
{
|
||||
if (mFonts) {
|
||||
PRUint32 i;
|
||||
for (i=0; i<mCount; i++) {
|
||||
nsMemory::Free(mFonts[i]);
|
||||
}
|
||||
nsMemory::Free(mFonts);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsFontListEnumerator, nsISimpleEnumerator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontListEnumerator::Init(const PRUnichar *aLangGroup,
|
||||
const PRUnichar *aFontType)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFontEnumerator> fontEnumerator;
|
||||
|
||||
fontEnumerator = do_CreateInstance(kCFontEnumerator, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsXPIDLCString langGroup;
|
||||
langGroup.Adopt(ToNewUTF8String(nsDependentString(aLangGroup)));
|
||||
nsXPIDLCString fontType;
|
||||
fontType.Adopt(ToNewUTF8String(nsDependentString(aFontType)));
|
||||
rv = fontEnumerator->EnumerateFonts(langGroup.get(), fontType.get(),
|
||||
&mCount, &mFonts);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontListEnumerator::HasMoreElements(PRBool *result)
|
||||
{
|
||||
*result = (mIndex < mCount);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontListEnumerator::GetNext(nsISupports **aFont)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFont);
|
||||
*aFont = nsnull;
|
||||
if (mIndex >= mCount) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
PRUnichar *fontName = mFonts[mIndex++];
|
||||
nsCOMPtr<nsISupportsString> fontNameWrapper;
|
||||
nsresult rv;
|
||||
fontNameWrapper = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(fontNameWrapper, NS_ERROR_OUT_OF_MEMORY);
|
||||
fontNameWrapper->SetData(nsDependentString(fontName));
|
||||
*aFont = static_cast<nsISupports*>(fontNameWrapper);
|
||||
NS_ADDREF(*aFont);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontList::AvailableFonts(const PRUnichar *aLangGroup,
|
||||
const PRUnichar *aFontType,
|
||||
nsISimpleEnumerator **aFontEnumerator)
|
||||
{
|
||||
NS_ENSURE_ARG(aLangGroup);
|
||||
NS_ENSURE_ARG(aFontType);
|
||||
NS_ENSURE_ARG_POINTER(aFontEnumerator);
|
||||
nsCOMPtr<nsFontListEnumerator> fontListEnum = new nsFontListEnumerator();
|
||||
NS_ENSURE_TRUE(fontListEnum.get(), NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = fontListEnum->Init(aLangGroup, aFontType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aFontEnumerator = static_cast<nsISimpleEnumerator*>(fontListEnum);
|
||||
NS_ADDREF(*aFontEnumerator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Stell <bstell@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 GPL or the LGPL. 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 ***** */
|
||||
|
||||
/*
|
||||
* Implementation of nsIFontList
|
||||
*/
|
||||
|
||||
#ifndef _nsFontList_H_
|
||||
#define _nsFontList_H_
|
||||
|
||||
#include "nsIFontList.h"
|
||||
#include "gfxCore.h"
|
||||
|
||||
#define NS_FONTLIST_CONTRACTID "@mozilla.org/gfx/fontlist;1"
|
||||
|
||||
|
||||
class NS_GFX nsFontList : public nsIFontList
|
||||
{
|
||||
public:
|
||||
nsFontList();
|
||||
virtual ~nsFontList();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFontList
|
||||
NS_DECL_NSIFONTLIST
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif /* _nsFontList_H_ */
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "nsDeviceContextPh.h"
|
||||
#include "nsPrintOptionsPh.h"
|
||||
#include "nsPrintSession.h"
|
||||
#include "nsFontList.h"
|
||||
#include "gfxImageFrame.h"
|
||||
|
||||
// objects that just require generic constructors
|
||||
@@ -63,7 +62,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionPh)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecPh)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorPh)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerPh)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorPh)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsPh, Init)
|
||||
@@ -165,11 +163,6 @@ static const nsModuleComponentInfo components[] =
|
||||
"@mozilla.org/gfx/fontenumerator;1",
|
||||
nsFontEnumeratorPhConstructor },
|
||||
|
||||
{ "Font List",
|
||||
NS_FONTLIST_CID,
|
||||
NS_FONTLIST_CONTRACTID,
|
||||
nsFontListConstructor },
|
||||
|
||||
{ "Ph Screen Manager",
|
||||
NS_SCREENMANAGER_CID,
|
||||
"@mozilla.org/gfx/screenmanager;1",
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "nsRegionWin.h"
|
||||
#include "nsBlender.h"
|
||||
#include "nsScriptableRegion.h"
|
||||
#include "nsFontList.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "gfxImageFrame.h"
|
||||
|
||||
@@ -60,7 +59,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDrawingSurfaceWin)
|
||||
//NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableRegion)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorWin)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(gfxImageFrame)
|
||||
|
||||
PRBool
|
||||
@@ -185,11 +183,6 @@ static const nsModuleComponentInfo components[] =
|
||||
"@mozilla.org/gfx/fontenumerator;1",
|
||||
nsFontEnumeratorWinConstructor },
|
||||
|
||||
{ "nsFontList",
|
||||
NS_FONTLIST_CID,
|
||||
"@mozilla.org/gfx/fontlist;1",
|
||||
nsFontListConstructor },
|
||||
|
||||
{ "windows image frame",
|
||||
GFX_IMAGEFRAME_CID,
|
||||
"@mozilla.org/gfx/image/frame;2",
|
||||
|
||||
Reference in New Issue
Block a user