mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Remove freetype2 code, which was used only by the old gfx code. b=389697 r+a1.9=vlad
This commit is contained in:
parent
27f6191a4a
commit
aef9a7524d
@ -479,7 +479,6 @@ MOZ_DBUS_GLIB_CFLAGS = @MOZ_DBUS_GLIB_CFLAGS@
|
||||
MOZ_DBUS_GLIB_LIBS = @MOZ_DBUS_GLIB_LIBS@
|
||||
MOZ_ENABLE_DBUS = @MOZ_ENABLE_DBUS@
|
||||
|
||||
MOZ_ENABLE_FREETYPE2 = @MOZ_ENABLE_FREETYPE2@
|
||||
FT2_CFLAGS = @FT2_CFLAGS@
|
||||
FT2_LIBS = @FT2_LIBS@
|
||||
|
||||
|
24
configure.in
24
configure.in
@ -4762,26 +4762,6 @@ fi
|
||||
AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
|
||||
AC_SUBST(MOZ_DISTRIBUTION_ID)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = FreeType2
|
||||
dnl = Enable freetype by default if building against X11
|
||||
dnl = and freetype is available
|
||||
dnl ========================================================
|
||||
MOZ_ARG_DISABLE_BOOL(freetype2,
|
||||
[ --disable-freetype2 Disable FreeType2 support ],
|
||||
MOZ_ENABLE_FREETYPE2=,
|
||||
MOZ_ENABLE_FREETYPE2=1)
|
||||
|
||||
if test "$MOZ_ENABLE_FREETYPE2" && test -z "$MOZ_X11" -o -z "$_HAVE_FREETYPE2"; then
|
||||
AC_MSG_ERROR([Cannot enable FreeType2 support for non-X11 toolkits or if FreeType2 is not detected.])
|
||||
fi
|
||||
|
||||
if test "$MOZ_ENABLE_FREETYPE2"; then
|
||||
AC_DEFINE(MOZ_ENABLE_FREETYPE2)
|
||||
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES MOZ_ENABLE_FREETYPE2"
|
||||
fi
|
||||
AC_SUBST(MOZ_ENABLE_FREETYPE2)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Xft
|
||||
dnl ========================================================
|
||||
@ -4798,10 +4778,6 @@ if test "$MOZ_ENABLE_XFT" && test -z "$MOZ_ENABLE_GTK2"; then
|
||||
AC_MSG_ERROR([Cannot enable XFT support for non-GTK2 toolkits.])
|
||||
fi
|
||||
|
||||
if test "$MOZ_ENABLE_XFT" && test "$MOZ_ENABLE_FREETYPE2"; then
|
||||
AC_MSG_ERROR([Cannot enable XFT and FREETYPE2 at the same time.])
|
||||
fi
|
||||
|
||||
if test "$MOZ_ENABLE_XFT"
|
||||
then
|
||||
AC_DEFINE(MOZ_ENABLE_XFT)
|
||||
|
@ -55,12 +55,5 @@ XPIDLSRCS = \
|
||||
gfxtypes.idl \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_ENABLE_FREETYPE2
|
||||
XPIDLSRCS += \
|
||||
nsIFontCatalogService.idl \
|
||||
nsIFreeType2.idl \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -1,123 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; 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
|
||||
* Christopher Blizzard <blizzard@mozilla.org>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pete Zha <pete.zha@sun.com>
|
||||
* Brian Stell <bstell@ix.netcom.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIArray.idl"
|
||||
|
||||
[noscript, uuid(70406f93-5b53-49a0-b5a7-ebf533bfe59b)]
|
||||
interface nsIFontCatalogEntry : nsISupports
|
||||
{
|
||||
const short FONT_CATALOG_TRUETYPE = 1;
|
||||
|
||||
readonly attribute unsigned short fontCatalogType;
|
||||
};
|
||||
|
||||
[noscript, uuid(11f3efad-316e-4982-b9cf-9c304b0d5237)]
|
||||
interface nsITrueTypeFontCatalogEntry : nsIFontCatalogEntry
|
||||
{
|
||||
readonly attribute ACString fileName;
|
||||
readonly attribute ACString familyName;
|
||||
readonly attribute ACString styleName;
|
||||
readonly attribute ACString vendorID;
|
||||
readonly attribute short faceIndex;
|
||||
readonly attribute short numFaces;
|
||||
readonly attribute short numEmbeddedBitmaps;
|
||||
readonly attribute long numGlyphs;
|
||||
readonly attribute long numUsableGlyphs;
|
||||
readonly attribute unsigned short weight;
|
||||
readonly attribute unsigned short width;
|
||||
readonly attribute unsigned long flags;
|
||||
readonly attribute long long faceFlags;
|
||||
readonly attribute long long styleFlags;
|
||||
readonly attribute unsigned long codePageRange1;
|
||||
readonly attribute unsigned long codePageRange2;
|
||||
readonly attribute long long fileModTime;
|
||||
|
||||
void getCCMap(out unsigned long size,
|
||||
[retval, array, size_is(size)] out unsigned short ccMaps);
|
||||
|
||||
void getEmbeddedBitmapHeights(out unsigned long size,
|
||||
[retval, array, size_is(size)] out long heights);
|
||||
};
|
||||
|
||||
[noscript, uuid(a3057187-c40f-4ffa-9160-2b16482053b1)]
|
||||
interface nsIFontCatalogService : nsISupports
|
||||
{
|
||||
nsIArray getFontCatalogEntries(in ACString familyName,
|
||||
in ACString language,
|
||||
in unsigned short weight,
|
||||
in unsigned short width,
|
||||
in unsigned short slant,
|
||||
in unsigned short spacing);
|
||||
|
||||
// Definition for weight
|
||||
const unsigned short kFCWeightAny = 0;
|
||||
const unsigned short kFCWeightLight = 300;
|
||||
const unsigned short kFCWeightBook = 400;
|
||||
const unsigned short kFCWeightMedium = 400;
|
||||
const unsigned short kFCWeightRegular = 400;
|
||||
const unsigned short kFCWeightDemi = 600;
|
||||
const unsigned short kFCWeightDemibold = 600;
|
||||
const unsigned short kFCWeightBold = 700;
|
||||
const unsigned short kFCWeighBlack = 900;
|
||||
|
||||
// Definition for width
|
||||
const unsigned short kFCWidthAny = 0;
|
||||
const unsigned short kFCWidthNarrow = 3;
|
||||
const unsigned short kFCWidthSemicondensed = 4;
|
||||
const unsigned short kFCWidthBlock = 5;
|
||||
const unsigned short kFCWidthMedium = 5;
|
||||
const unsigned short kFCWidthNormal = 5;
|
||||
const unsigned short kFCWidthBold = 7;
|
||||
const unsigned short kFCWidthWide = 7;
|
||||
const unsigned short kFCWidthDoubleWide = 9;
|
||||
|
||||
// Definition for slant
|
||||
const unsigned short kFCSlantAny = 0;
|
||||
const unsigned short kFCSlantRoman = 1;
|
||||
const unsigned short kFCSlantItalic = 2;
|
||||
const unsigned short kFCSlantOblique = 3;
|
||||
const unsigned short kFCSlantReverseItalic = 4;
|
||||
const unsigned short kFCSlantReverseOblique = 5;
|
||||
|
||||
// Definition for spacing
|
||||
const unsigned short kFCSpacingAny = 0;
|
||||
const unsigned short kFCSpacingMonospace = 1;
|
||||
const unsigned short kFCSpacingProportional = 2;
|
||||
};
|
@ -1,141 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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 Golden Hills Computer Services code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Brian Stell.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Stell <bstell@ix.netcom.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
%{C++
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_CACHE_H
|
||||
#include FT_CACHE_IMAGE_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
#define NS_FREETYPE2_CONTRACTID "@mozilla.org/freetype2;1"
|
||||
#define NS_FREETYPE2_CID NS_IFREETYPE2_IID
|
||||
// macros to handle FreeType2 26.6 numbers (26 bit number with 6 bit fraction)
|
||||
#define FT_REG_TO_16_16(x) ((x)<<16)
|
||||
#ifndef FT_MulFix
|
||||
#define FT_MulFix(v, s) (((v)*(s))>>16)
|
||||
#endif
|
||||
#define FT_ROUND(x) (((x) + 32) & ~63) // 63 = 2^6 - 1
|
||||
#define FT_TRUNC(x) ((x) >> 6)
|
||||
#define FT_DESIGN_UNITS_TO_PIXELS(v, s) FT_TRUNC(FT_ROUND(FT_MulFix((v) , (s))))
|
||||
|
||||
%}
|
||||
|
||||
|
||||
[ptr] native constCharPtr(const char);
|
||||
native FT_Int(FT_Int);
|
||||
native FT_Long(FT_Long);
|
||||
native FT_UInt(FT_UInt);
|
||||
native FT_ULong(FT_ULong);
|
||||
|
||||
native FT_BBox(FT_BBox);
|
||||
native FT_CharMap(FT_CharMap);
|
||||
native FT_Error(FT_Error);
|
||||
native FT_Face(FT_Face);
|
||||
native FT_Glyph(FT_Glyph);
|
||||
native FT_GlyphSlot(FT_GlyphSlot);
|
||||
native FT_Library(FT_Library);
|
||||
[ptr] native FT_Outline_p(FT_Outline);
|
||||
[ptr] native const_FT_Outline_Funcs_p(const FT_Outline_Funcs);
|
||||
native FT_Pointer(FT_Pointer);
|
||||
native FT_Sfnt_Tag(FT_Sfnt_Tag);
|
||||
native FT_Size(FT_Size);
|
||||
|
||||
[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
|
||||
native FTC_Face_Requester(FTC_Face_Requester);
|
||||
native FTC_Font(FTC_Font);
|
||||
native FTC_Image_Cache(FTC_Image_Cache);
|
||||
native FTC_Manager(FTC_Manager);
|
||||
|
||||
// #ifdef MOZ_SVG
|
||||
[ptr] native FT_Matrix_p(FT_Matrix);
|
||||
native FT_Vector(FT_Vector);
|
||||
[ptr] native FT_Vector_p(FT_Vector);
|
||||
native FT_Render_Mode(FT_Render_Mode);
|
||||
native FT_Bool(FT_Bool);
|
||||
// #endif
|
||||
|
||||
/*
|
||||
* A XPCOM interface to the run-time loaded functions
|
||||
*/
|
||||
[uuid(c6e09354-1bb1-4ec2-aaa3-a26d0aafe36d)]
|
||||
interface nsIFreeType2 : nsISupports
|
||||
{
|
||||
|
||||
readonly attribute FT_Library library;
|
||||
readonly attribute FTC_Manager FTCacheManager;
|
||||
readonly attribute FTC_Image_Cache ImageCache;
|
||||
|
||||
void doneFace(in FT_Face face);
|
||||
void doneFreeType(in FT_Library lib);
|
||||
void doneGlyph(in FT_Glyph glyph);
|
||||
FT_UInt getCharIndex(in FT_Face face, in FT_ULong charcode);
|
||||
void getGlyph(in FT_GlyphSlot slot, out FT_Glyph glyph);
|
||||
voidPtr getSfntTable(in FT_Face face, in FT_Sfnt_Tag tag);
|
||||
void glyphGetCBox(in FT_Glyph glyph, in FT_UInt mode, out FT_BBox box);
|
||||
void initFreeType(out FT_Library lib);
|
||||
void loadGlyph(in FT_Face face, in FT_UInt gindex, in FT_Int flags);
|
||||
void newFace(in FT_Library lib, in constCharPtr filename,
|
||||
in FT_Long face_num, out FT_Face face);
|
||||
void outlineDecompose(in FT_Outline_p outline,
|
||||
in const_FT_Outline_Funcs_p funcs, in voidPtr p);
|
||||
void setCharmap(in FT_Face face, in FT_CharMap charmap);
|
||||
void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
|
||||
in FT_UInt gindex, out FT_Glyph glyph);
|
||||
void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
|
||||
out FT_Face face, out FT_Size size);
|
||||
void managerDone(in FTC_Manager manager);
|
||||
void managerNew(in FT_Library lib, in FT_UInt max_faces,
|
||||
in FT_UInt max_sizes, in FT_ULong max_bytes,
|
||||
in FTC_Face_Requester requester, in FT_Pointer req_data,
|
||||
out FTC_Manager manager);
|
||||
void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
|
||||
/* #ifdef MOZ_SVG */
|
||||
void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
|
||||
in FT_Vector_p delta);
|
||||
void getKerning(in FT_Face face, in FT_UInt left_glyph, in FT_UInt right_glyph,
|
||||
in FT_UInt kern_mode, out FT_Vector akerning);
|
||||
void glyphCopy(in FT_Glyph source, out FT_Glyph target);
|
||||
void glyphToBitmap(inout FT_Glyph the_glyph, in FT_Render_Mode render_mode,
|
||||
in FT_Vector_p origin, in FT_Bool destroy);
|
||||
/* #endif */
|
||||
|
||||
FT_ULong getFirstChar(in FT_Face face, out FT_UInt gindex);
|
||||
FT_ULong getNextChar(in FT_Face face, in FT_ULong charcode, out FT_UInt gindex);
|
||||
void supportsExtFunc(out PRBool res);
|
||||
};
|
@ -64,10 +64,6 @@ REQUIRES = xpcom \
|
||||
|
||||
DIRS = shared
|
||||
|
||||
ifdef MOZ_ENABLE_FREETYPE2
|
||||
DIRS += freetype
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_POSTSCRIPT
|
||||
DIRS += psshared
|
||||
endif
|
||||
|
@ -1,76 +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 mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = gfx
|
||||
LIBRARY_NAME = gfxft2_s
|
||||
FORCE_STATIC_LIB= 1
|
||||
EXPORT_LIBRARY = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
pref \
|
||||
uconv \
|
||||
unicharutil \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsFreeType.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(LIBS_DIR) \
|
||||
-lgkgfx \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef MOZ_ENABLE_FREETYPE2
|
||||
LOCAL_INCLUDES = -I../..
|
||||
INCLUDES += $(FT2_CFLAGS)
|
||||
# due to runtime linking with PR_LoadLibrary
|
||||
# EXTRA_DSO_LDOPTS does not need $(FT2_LIBS)
|
||||
endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,323 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ex: set tabstop=8 softtabstop=2 shiftwidth=2 expandtab:
|
||||
*
|
||||
* ***** 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) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsFreeType_h__
|
||||
#define nsFreeType_h__
|
||||
|
||||
#include "gfx-config.h"
|
||||
#if (defined(MOZ_ENABLE_FREETYPE2))
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIFontCatalogService.h"
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_CACHE_H
|
||||
#include FT_CACHE_IMAGE_H
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
#include "nsIFreeType2.h"
|
||||
|
||||
typedef struct FT_FaceRec_* FT_Face;
|
||||
|
||||
typedef struct {
|
||||
const char *mFontFileName;
|
||||
time_t mMTime;
|
||||
PRUint32 mFlags;
|
||||
const char *mFontType;
|
||||
int mFaceIndex;
|
||||
int mNumFaces;
|
||||
const char *mFamilyName;
|
||||
const char *mStyleName;
|
||||
FT_UShort mWeight;
|
||||
FT_UShort mWidth;
|
||||
int mNumGlyphs;
|
||||
int mNumUsableGlyphs;
|
||||
FT_Long mFaceFlags;
|
||||
FT_Long mStyleFlags;
|
||||
FT_Long mCodePageRange1;
|
||||
FT_Long mCodePageRange2;
|
||||
char mVendorID[5];
|
||||
const char *mFoundryName;
|
||||
int mNumEmbeddedBitmaps;
|
||||
int *mEmbeddedBitmapHeights;
|
||||
PRUint16 *mCCMap; // compressed char map
|
||||
} nsFontCatalogEntry;
|
||||
|
||||
#define FCE_FLAGS_ISVALID 0x01
|
||||
#define FCE_FLAGS_UNICODE 0x02
|
||||
#define FCE_FLAGS_SYMBOL 0x04
|
||||
#define FCE_FLAGS_SURROGATE 0x08
|
||||
#define FREE_IF(x) if(x) free((void*)x)
|
||||
|
||||
typedef struct {
|
||||
const char *mConverterName;
|
||||
PRUint8 mCmapPlatformID;
|
||||
PRUint8 mCmapEncoding;
|
||||
nsIUnicodeEncoder* mConverter;
|
||||
} nsTTFontEncoderInfo;
|
||||
|
||||
typedef struct nsTTFontFamilyEncoderInfo {
|
||||
const char *mFamilyName;
|
||||
nsTTFontEncoderInfo *mEncodingInfo;
|
||||
} nsTTFontFamilyEncoderInfo;
|
||||
|
||||
typedef struct {
|
||||
unsigned long bit;
|
||||
const char *charsetName;
|
||||
} nsulCodePageRangeCharSetName;
|
||||
|
||||
//
|
||||
// the FreeType2 function type declarations
|
||||
//
|
||||
typedef FT_Error (*FT_Done_Face_t)(FT_Face);
|
||||
typedef FT_Error (*FT_Done_FreeType_t)(FT_Library);
|
||||
typedef FT_Error (*FT_Done_Glyph_t)(FT_Glyph);
|
||||
typedef FT_Error (*FT_Get_Char_Index_t)(FT_Face, FT_ULong);
|
||||
typedef FT_Error (*FT_Get_Glyph_t)(FT_GlyphSlot, FT_Glyph*);
|
||||
typedef void* (*FT_Get_Sfnt_Table_t)(FT_Face, FT_Sfnt_Tag);
|
||||
typedef FT_Error (*FT_Glyph_Get_CBox_t)(FT_Glyph, FT_UInt, FT_BBox*);
|
||||
typedef FT_Error (*FT_Init_FreeType_t)(FT_Library*);
|
||||
typedef FT_Error (*FT_Load_Glyph_t)(FT_Face, FT_UInt, FT_Int);
|
||||
typedef FT_Error (*FT_Outline_Decompose_t)
|
||||
(FT_Outline*, const FT_Outline_Funcs*, void*);
|
||||
typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
|
||||
typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
|
||||
typedef FT_Error (*FTC_Image_Cache_Lookup_t)
|
||||
(FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
|
||||
typedef FT_Error (*FTC_Manager_Lookup_Size_t)
|
||||
(FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
|
||||
typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
|
||||
typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
|
||||
FTC_Face_Requester, FT_Pointer, FTC_Manager*);
|
||||
typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
|
||||
// #ifdef MOZ_SVG
|
||||
typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
|
||||
typedef FT_Error (*FT_Get_Kerning_t)
|
||||
(FT_Face, FT_UInt, FT_UInt, FT_UInt, FT_Vector*);
|
||||
typedef FT_Error (*FT_Glyph_Copy_t)(FT_Glyph, FT_Glyph*);
|
||||
typedef FT_Error (*FT_Glyph_To_Bitmap_t)
|
||||
(FT_Glyph*, FT_Render_Mode, FT_Vector*, FT_Bool);
|
||||
// #endif
|
||||
|
||||
typedef FT_ULong (*FT_Get_First_Char_t)(FT_Face, FT_UInt*);
|
||||
typedef FT_ULong (*FT_Get_Next_Char_t)(FT_Face, FT_ULong, FT_UInt*);
|
||||
|
||||
class nsFreeTypeFace;
|
||||
|
||||
nsFreeTypeFace * nsFreeTypeGetFaceID(nsFontCatalogEntry *aFce);
|
||||
|
||||
typedef struct {
|
||||
const char *FuncName;
|
||||
long FuncOffset;
|
||||
const PRBool Required;
|
||||
} FtFuncList;
|
||||
|
||||
// class nsFreeType class definition
|
||||
class nsFreeType2 : nsIFreeType2 {
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
void FreeGlobals();
|
||||
nsresult Init();
|
||||
virtual ~nsFreeType2();
|
||||
|
||||
NS_DECL_NSIFREETYPE2
|
||||
|
||||
// these belong in nsFT2FontCatalog
|
||||
static PRUint16* GetCCMap(nsFontCatalogEntry *aFce);
|
||||
static const char* GetRange1CharSetName(unsigned long aBit);
|
||||
static const char* GetRange2CharSetName(unsigned long aBit);
|
||||
static nsTTFontFamilyEncoderInfo* GetCustomEncoderInfo(const char *);
|
||||
|
||||
protected:
|
||||
// run time loaded function pointers
|
||||
FT_Done_Face_t nsFT_Done_Face;
|
||||
FT_Done_FreeType_t nsFT_Done_FreeType;
|
||||
FT_Done_Glyph_t nsFT_Done_Glyph;
|
||||
FT_Get_Char_Index_t nsFT_Get_Char_Index;
|
||||
FT_Get_Glyph_t nsFT_Get_Glyph;
|
||||
FT_Get_Sfnt_Table_t nsFT_Get_Sfnt_Table;
|
||||
FT_Glyph_Get_CBox_t nsFT_Glyph_Get_CBox;
|
||||
FT_Init_FreeType_t nsFT_Init_FreeType;
|
||||
FT_Load_Glyph_t nsFT_Load_Glyph;
|
||||
FT_New_Face_t nsFT_New_Face;
|
||||
FT_Outline_Decompose_t nsFT_Outline_Decompose;
|
||||
FT_Set_Charmap_t nsFT_Set_Charmap;
|
||||
FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
|
||||
FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
|
||||
FTC_Manager_Done_t nsFTC_Manager_Done;
|
||||
FTC_Manager_New_t nsFTC_Manager_New;
|
||||
FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
|
||||
// #ifdef MOZ_SVG
|
||||
FT_Glyph_Transform_t nsFT_Glyph_Transform;
|
||||
FT_Get_Kerning_t nsFT_Get_Kerning;
|
||||
FT_Glyph_Copy_t nsFT_Glyph_Copy;
|
||||
FT_Glyph_To_Bitmap_t nsFT_Glyph_To_Bitmap;
|
||||
// #endif
|
||||
FT_Get_First_Char_t nsFT_Get_First_Char;
|
||||
FT_Get_Next_Char_t nsFT_Get_Next_Char;
|
||||
|
||||
// this array needs to be big enough to hold all the function pointers
|
||||
// plus one extra for the null at the end
|
||||
// #ifdef MOZ_SVG
|
||||
static FtFuncList FtFuncs[24];
|
||||
// #else
|
||||
// static FtFuncList FtFuncs[20];
|
||||
// #endif
|
||||
|
||||
protected:
|
||||
PRBool mEnableFreeType2;
|
||||
char* mFreeType2SharedLibraryName;
|
||||
|
||||
public:
|
||||
// these belong in the nsFontFreeType code
|
||||
static PRBool gFreeType2Autohinted;
|
||||
static PRBool gFreeType2Unhinted;
|
||||
static PRUint8 gAATTDarkTextMinValue;
|
||||
static double gAATTDarkTextGain;
|
||||
static PRInt32 gAntiAliasMinimum;
|
||||
static PRInt32 gEmbeddedBitmapMaximumHeight;
|
||||
static PRBool gHasExtFunc;
|
||||
|
||||
protected:
|
||||
void ClearGlobals();
|
||||
void ClearFunctions();
|
||||
PRBool InitLibrary();
|
||||
PRBool LoadSharedLib();
|
||||
void UnloadSharedLib();
|
||||
|
||||
// this belongs in nsFT2FontCatalog
|
||||
static nsICharsetConverterManager* GetCharSetManager();
|
||||
|
||||
PRLibrary *mSharedLib;
|
||||
FT_Library mFreeTypeLibrary;
|
||||
FTC_Manager mFTCacheManager;
|
||||
FTC_Image_Cache mImageCache;
|
||||
|
||||
static nsHashtable *sFontFamilies;
|
||||
static nsHashtable *sRange1CharSetNames;
|
||||
static nsHashtable *sRange2CharSetNames;
|
||||
static nsICharsetConverterManager* sCharSetManager;
|
||||
};
|
||||
|
||||
/* this simple record is used to model a given `installed' face */
|
||||
class nsFreeTypeFace : public nsITrueTypeFontCatalogEntry {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITRUETYPEFONTCATALOGENTRY
|
||||
|
||||
nsFreeTypeFace();
|
||||
virtual ~nsFreeTypeFace();
|
||||
virtual nsresult Init(nsFontCatalogEntry *aFce);
|
||||
/* additional members */
|
||||
NS_IMETHODIMP GetFontCatalogType(PRUint16 *aFontCatalogType);
|
||||
|
||||
static PRBool FreeFace(nsHashKey* aKey, void* aData, void* aClosure);
|
||||
const char *GetFilename()
|
||||
{ return mFce->mFontFileName; }
|
||||
int *GetEmbeddedBitmapHeights()
|
||||
{ return mFce->mEmbeddedBitmapHeights; } ;
|
||||
int GetFaceIndex()
|
||||
{ return mFce->mFaceIndex; }
|
||||
int GetNumEmbeddedBitmaps()
|
||||
{ return mFce->mNumEmbeddedBitmaps; } ;
|
||||
PRUint16 *GetCCMap();
|
||||
nsFontCatalogEntry* GetFce() { return mFce; };
|
||||
|
||||
PRBool mHasExtendFuncs;
|
||||
|
||||
protected:
|
||||
nsFontCatalogEntry *mFce;
|
||||
PRUint16 *mCCMap;
|
||||
|
||||
};
|
||||
|
||||
#endif /* MOZ_ENABLE_FREETYPE2 */
|
||||
|
||||
/*
|
||||
* Defines for the TrueType codepage bits.
|
||||
* Used as a hint for the languages supported in a TrueType font.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ulCodePageRange1
|
||||
*/
|
||||
#define TT_OS2_CPR1_LATIN1 (0x00000001) /* Latin 1 */
|
||||
#define TT_OS2_CPR1_LATIN2 (0x00000002) /* Latin 2: Eastern Europe */
|
||||
#define TT_OS2_CPR1_CYRILLIC (0x00000004) /* Cyrillic */
|
||||
#define TT_OS2_CPR1_GREEK (0x00000008) /* Greek */
|
||||
#define TT_OS2_CPR1_TURKISH (0x00000010) /* Turkish */
|
||||
#define TT_OS2_CPR1_HEBREW (0x00000020) /* Hebrew */
|
||||
#define TT_OS2_CPR1_ARABIC (0x00000040) /* Arabic */
|
||||
#define TT_OS2_CPR1_BALTIC (0x00000080) /* Windows Baltic */
|
||||
#define TT_OS2_CPR1_VIETNAMESE (0x00000100) /* Vietnamese */
|
||||
/* 9-15 Reserved for Alternate ANSI */
|
||||
#define TT_OS2_CPR1_THAI (0x00010000) /* Thai */
|
||||
#define TT_OS2_CPR1_JAPANESE (0x00020000) /* JIS/Japan */
|
||||
#define TT_OS2_CPR1_CHINESE_SIMP (0x00040000) /* Chinese: Simplified */
|
||||
#define TT_OS2_CPR1_KO_WANSUNG (0x00080000) /* Korean Wansung */
|
||||
#define TT_OS2_CPR1_CHINESE_TRAD (0x00100000) /* Chinese: Traditional */
|
||||
#define TT_OS2_CPR1_KO_JOHAB (0x00200000) /* Korean Johab */
|
||||
/* 22-28 Reserved for Alternate ANSI&OEM */
|
||||
#define TT_OS2_CPR1_MAC_ROMAN (0x20000000) /* Mac (US Roman) */
|
||||
#define TT_OS2_CPR1_OEM (0x40000000) /* OEM Character Set */
|
||||
#define TT_OS2_CPR1_SYMBOL (0x80000000) /* Symbol Character Set */
|
||||
|
||||
/*
|
||||
* ulCodePageRange2
|
||||
*/ /* 32-47 Reserved for OEM */
|
||||
#define TT_OS2_CPR2_GREEK (0x00010000) /* IBM Greek */
|
||||
#define TT_OS2_CPR2_RUSSIAN (0x00020000) /* MS-DOS Russian */
|
||||
#define TT_OS2_CPR2_NORDIC (0x00040000) /* MS-DOS Nordic */
|
||||
#define TT_OS2_CPR2_ARABIC (0x00080000) /* Arabic */
|
||||
#define TT_OS2_CPR2_CA_FRENCH (0x00100000) /* MS-DOS Canadian French */
|
||||
#define TT_OS2_CPR2_HEBREW (0x00200000) /* Hebrew */
|
||||
#define TT_OS2_CPR2_ICELANDIC (0x00400000) /* MS-DOS Icelandic */
|
||||
#define TT_OS2_CPR2_PORTUGESE (0x00800000) /* MS-DOS Portuguese */
|
||||
#define TT_OS2_CPR2_TURKISH (0x01000000) /* IBM Turkish */
|
||||
#define TT_OS2_CPR2_CYRILLIC (0x02000000)/*IBM Cyrillic; primarily Russian*/
|
||||
#define TT_OS2_CPR2_LATIN2 (0x04000000) /* Latin 2 */
|
||||
#define TT_OS2_CPR2_BALTIC (0x08000000) /* MS-DOS Baltic */
|
||||
#define TT_OS2_CPR2_GREEK_437G (0x10000000) /* Greek; former 437 G */
|
||||
#define TT_OS2_CPR2_ARABIC_708 (0x20000000) /* Arabic; ASMO 708 */
|
||||
#define TT_OS2_CPR2_WE_LATIN1 (0x40000000) /* WE/Latin 1 */
|
||||
#define TT_OS2_CPR2_US (0x80000000) /* US */
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user