Separate previously-copied font constants into their own file and have them in one place rather than three. (Bug 3512) r=vlad

This commit is contained in:
L. David Baron 2009-01-29 12:39:18 -08:00
Родитель 9fe2209b0f
Коммит 48f0a08ad3
6 изменённых файлов: 79 добавлений и 22 удалений

Просмотреть файл

@ -41,6 +41,7 @@
#include "gfxCore.h"
#include "nsCoord.h"
#include "nsStringGlue.h"
#include "gfxFontConstants.h"
// XXX we need a method to enumerate all of the possible fonts on the
// system across family, weight, style, size, etc. But not here!
@ -134,10 +135,6 @@ struct NS_GFX nsFont {
static void GetGenericID(const nsString& aGeneric, PRUint8* aID);
};
#define NS_FONT_STYLE_NORMAL 0
#define NS_FONT_STYLE_ITALIC 1
#define NS_FONT_STYLE_OBLIQUE 2
#define NS_FONT_VARIANT_NORMAL 0
#define NS_FONT_VARIANT_SMALL_CAPS 1
@ -146,7 +143,4 @@ struct NS_GFX nsFont {
#define NS_FONT_DECORATION_OVERLINE 0x2
#define NS_FONT_DECORATION_LINE_THROUGH 0x4
#define NS_FONT_WEIGHT_NORMAL 400
#define NS_FONT_WEIGHT_BOLD 700
#endif /* nsFont_h___ */

Просмотреть файл

@ -18,6 +18,7 @@ EXPORTS = gfxASurface.h \
gfxColor.h \
gfxContext.h \
gfxFont.h \
gfxFontConstants.h \
gfxFontUtils.h \
gfxImageSurface.h \
gfxMatrix.h \

Просмотреть файл

@ -51,6 +51,7 @@
#include "gfxSkipChars.h"
#include "gfxRect.h"
#include "nsExpirationTracker.h"
#include "gfxFontConstants.h"
#ifdef DEBUG
#include <stdio.h>
@ -64,12 +65,14 @@ class gfxFontGroup;
class gfxUserFontSet;
class gfxUserFontData;
#define FONT_STYLE_NORMAL 0
#define FONT_STYLE_ITALIC 1
#define FONT_STYLE_OBLIQUE 2
// We should eliminate these synonyms when it won't cause many merge conflicts.
#define FONT_STYLE_NORMAL NS_FONT_STYLE_NORMAL
#define FONT_STYLE_ITALIC NS_FONT_STYLE_ITALIC
#define FONT_STYLE_OBLIQUE NS_FONT_STYLE_OBLIQUE
#define FONT_WEIGHT_NORMAL 400
#define FONT_WEIGHT_BOLD 700
// We should eliminate these synonyms when it won't cause many merge conflicts.
#define FONT_WEIGHT_NORMAL NS_FONT_WEIGHT_NORMAL
#define FONT_WEIGHT_BOLD NS_FONT_WEIGHT_BOLD
#define FONT_MAX_SIZE 2000.0

Просмотреть файл

@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** 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 Foundation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2005
* 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 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 ***** */
/* font constants shared by both thebes and layout */
#ifndef GFX_FONT_CONSTANTS_H
#define GFX_FONT_CONSTANTS_H
/*
* This file is separate from gfxFont.h so that layout can include it
* without bringing in gfxFont.h and everything it includes.
*/
#define NS_FONT_STYLE_NORMAL 0
#define NS_FONT_STYLE_ITALIC 1
#define NS_FONT_STYLE_OBLIQUE 2
#define NS_FONT_WEIGHT_NORMAL 400
#define NS_FONT_WEIGHT_BOLD 700
#define NS_FONT_WEIGHT_BOLDER 1
#define NS_FONT_WEIGHT_LIGHTER -1
#endif

Просмотреть файл

@ -175,7 +175,7 @@ public:
// add in a font face
// weight, stretch - 0 == unknown, [1, 9] otherwise
// italic style = constants in gfxFont.h (e.g. FONT_STYLE_NORMAL)
// italic style = constants in gfxFontConstants.h, e.g. NS_FONT_STYLE_NORMAL
// TODO: support for unicode ranges not yet implemented
void AddFontFace(const nsAString& aFamilyName,
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,

Просмотреть файл

@ -408,19 +408,22 @@
#define NS_STYLE_FLOAT_RIGHT 2
// See nsStyleFont
#define NS_STYLE_FONT_STYLE_NORMAL 0
#define NS_STYLE_FONT_STYLE_ITALIC 1
#define NS_STYLE_FONT_STYLE_OBLIQUE 2
// We should eventually stop using the NS_STYLE_* variants here.
#define NS_STYLE_FONT_STYLE_NORMAL NS_FONT_STYLE_NORMAL
#define NS_STYLE_FONT_STYLE_ITALIC NS_FONT_STYLE_ITALIC
#define NS_STYLE_FONT_STYLE_OBLIQUE NS_FONT_STYLE_OBLIQUE
// See nsStyleFont
#define NS_STYLE_FONT_VARIANT_NORMAL 0
#define NS_STYLE_FONT_VARIANT_SMALL_CAPS 1
// We should eventually stop using the NS_STYLE_* variants here.
#define NS_STYLE_FONT_VARIANT_NORMAL NS_FONT_VARIANT_NORMAL
#define NS_STYLE_FONT_VARIANT_SMALL_CAPS NS_FONT_VARIANT_SMALL_CAPS
// See nsStyleFont
#define NS_STYLE_FONT_WEIGHT_NORMAL 400
#define NS_STYLE_FONT_WEIGHT_BOLD 700
#define NS_STYLE_FONT_WEIGHT_BOLDER 1
#define NS_STYLE_FONT_WEIGHT_LIGHTER -1
// We should eventually stop using the NS_STYLE_* variants here.
#define NS_STYLE_FONT_WEIGHT_NORMAL NS_FONT_WEIGHT_NORMAL
#define NS_STYLE_FONT_WEIGHT_BOLD NS_FONT_WEIGHT_BOLD
#define NS_STYLE_FONT_WEIGHT_BOLDER NS_FONT_WEIGHT_BOLDER
#define NS_STYLE_FONT_WEIGHT_LIGHTER NS_FONT_WEIGHT_LIGHTER
// See nsStyleFont
#define NS_STYLE_FONT_SIZE_XXSMALL 0