bug 176290 : custom font encoding support in Xft build (not a part of the default build). style clean-up is thanks to blizzard. r,sr (effectively) =blizzard, sr=rbs

This commit is contained in:
jshin%mailaps.org 2003-06-25 06:00:14 +00:00
parent 9edaa34b81
commit 78f1c6b87d
4 changed files with 1407 additions and 189 deletions

View File

@ -152,6 +152,14 @@ EXTRA_DSO_LDOPTS += \
$(NULL)
endif
ifdef MOZ_ENABLE_XFT
libs:: fontEncoding.properties
$(INSTALL) $^ $(DIST)/bin/res/fonts
install:: fontEncoding.properties
$(INSTALL) $^ $(DESTDIR)$(mozappdir)/res/fonts
endif
ifdef MOZ_ENABLE_GTK2
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) \
-lgkgfx \

View File

@ -0,0 +1,187 @@
##
## 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 MathML Project.
##
## The Initial Developer of the Original Code is The University Of
## Queensland. Portions created by The University Of Queensland are
## Copyright (C) 2001 The University Of Queensland. All Rights Reserved.
##
## Contributor(s):
## Roger B. Sidje <rbs@maths.uq.edu.au>
## Jungshik Shin <jshin@mailaps.org>
##
# LOCALIZATION NOTE: FILE
# Do not translate anything in this file
# This is a list of encodings used for special *symbolic fonts* (not documents) # for which we have converters (i.e., the intl/uconv library contains encoding # tables that provide a mapping of characters to the indices of the desired
# glyph shapes within these symbolic fonts).
#
# This file also lists truetype cmap tables for single byte ('narrow') special
# *symbolic fonts*. At the moment, only two values, 'mac_roman'
# and 'unicode' are recognized. These cmaps are used to translate custom font
# codes obtained through converters in intl/uconv library into glyph indices of # fonts with Freetype library. Do not change the value unless you're familiar
# with the internals of Freetype and Mozilla-Xft. If you're interested,
# see
# http://freetype.sourceforge.net/freetype2/docs/reference/ft2-base_interface.html#FT_Encoding
# and
# http://bugzilla.mozilla.org/show_bug.cgi?id=176290
#
# For each 'key = value' pair in this list:
#
# - the 'key' is a lower case ASCII with the *name of the font*, and the
# encoding type (e.g., .ttf for TrueType, and .t1 for Type 1). Note that
# the *name of a font* is not necessarily the *name of the file* that contains
# the font... All whitespace should be stripped from the name.
# For truetype cmaps, use .ftcmap in place of .ttf or .t1.
#
# - the 'value' is the case-sensitive charset string used when setting up the
# corresponding Unicode Converter in the intl/uconv library.
# - the 'value' for ftcmap is either mac_roman
# or unicode.
# If you have Symbol (Adobe) type 1 font, keep the following lines
# commented out (you do NOT need them). However, with truetype Symbol
# font, you do need them.
# Symbol font
#encoding.symbol.ttf = Adobe-Symbol-Encoding
#encoding.symbol.ftcmap = mac_roman
# TeX's Computer Modern fonts (Roman, Math Italic, Symbol and Extension)
encoding.cmr10.ttf = x-ttf-cmr
encoding.cmmi10.ttf = x-ttf-cmmi
encoding.cmsy10.ttf = x-ttf-cmsy
encoding.cmex10.ttf = x-ttf-cmex
encoding.cmr10.ftcmap = unicode
encoding.cmmi10.ftcmap = unicode
encoding.cmsy10.ftcmap = unicode
encoding.cmex10.ftcmap = unicode
# Mathematica fonts
encoding.math1.ttf = x-mathematica1
encoding.math1-bold.ttf = x-mathematica1
encoding.math1mono.ttf = x-mathematica1
encoding.math1mono-bold.ttf = x-mathematica1
encoding.math2.ttf = x-mathematica2
encoding.math2-bold.ttf = x-mathematica2
encoding.math2mono.ttf = x-mathematica2
encoding.math2mono-bold.ttf = x-mathematica2
encoding.math3.ttf = x-mathematica3
encoding.math3-bold.ttf = x-mathematica3
encoding.math3mono.ttf = x-mathematica3
encoding.math3mono-bold.ttf = x-mathematica3
encoding.math4.ttf = x-mathematica4
encoding.math4-bold.ttf = x-mathematica4
encoding.math4mono.ttf = x-mathematica4
encoding.math4mono-bold.ttf = x-mathematica4
encoding.math5.ttf = x-mathematica5
encoding.math5-bold.ttf = x-mathematica5
encoding.math5bold.ttf = x-mathematica5
encoding.math5mono.ttf = x-mathematica5
encoding.math5mono-bold.ttf = x-mathematica5
encoding.math5monobold.ttf = x-mathematica5
encoding.math1.ftcmap = mac_roman
encoding.math1-bold.ftcmap = mac_roman
encoding.math1mono.ftcmap = mac_roman
encoding.math1mono-bold.ftcmap = mac_roman
encoding.math2.ftcmap = mac_roman
encoding.math2-bold.ftcmap = mac_roman
encoding.math2mono.ftcmap = mac_roman
encoding.math2mono-bold.ftcmap = mac_roman
encoding.math3.ftcmap = mac_roman
encoding.math3-bold.ftcmap = mac_roman
encoding.math3mono.ftcmap = mac_roman
encoding.math3mono-bold.ftcmap = mac_roman
encoding.math4.ftcmap = mac_roman
encoding.math4-bold.ftcmap = mac_roman
encoding.math4mono.ftcmap = mac_roman
encoding.math4mono-bold.ftcmap = mac_roman
encoding.math5.ftcmap = mac_roman
encoding.math5-bold.ftcmap = mac_roman
encoding.math5bold.ftcmap = mac_roman
encoding.math5mono.ftcmap = mac_roman
encoding.math5mono-bold.ftcmap = mac_roman
encoding.math5monobold.ftcmap = mac_roman
# MathType Extra
encoding.mtextra.ttf = x-mtextra
encoding.mtextra.ftcmap = mac_roman
# Tamil fonts (TSCII encoding : see
# http://www.tscii.org and http://www.tamil.net). Not all 'TSCII fonts' are
# equal. I've confirmed the following fonts work, but other 'TSCII fonts' may
# not work. These fonts have pseudo-Unicode cmap with TSCII
# interpreted as Windows-1252.
#
encoding.tsc_paranarpdf.ttf = x-tamilttf-0.wide
encoding.tsc_paranbold.ttf = x-tamilttf-0.wide
encoding.tsc_paranarho.ttf = x-tamilttf-0.wide
encoding.tsc_kannadaasan.ttf = x-tamilttf-0.wide
encoding.tscu_comic.ttf = x-tamilttf-0.wide
encoding.tscu_times.ttf = x-tamilttf-0.wide
encoding.tscu_paranar.ttf = x-tamilttf-0.wide
encoding.tscu_paranarbold.ttf = x-tamilttf-0.wide
# These two fonts have conflicting MacRoman and Unicode Cmaps
# that get fontconfig confused.
#encoding.tsc_avarangal.ttf = x-tamilttf-0.wide
#encoding.tsc_avarangalfxd.ttf = x-tamilttf-0.wide
# These two fonts don't have Unicode cmap but have pseudo-Apple Roman cmap
# with TSCII assignment.
encoding.tsc_aandaal.ttf = x-tscii-0
encoding.tsc_aandaal.ftcmap = mac_roman
encoding.tsc_aparanarpdf.ttf = x-tscii-0
encoding.tsc_aparanarpdf.ftcmap = mac_roman
# The suffix '.wide' has to be added to encoding names to identify
# these fonts as 'wide' non-Unicode fonts.
# Korean Jamo TTFs
encoding.unbatang.ttf = x-koreanjamo-0.wide
# Thai TTFs
# glyph arrangement : TIS620-2 Windows encoding,
# code points used : Unicode Thai block + about 10 PUA code points in U+F700,
# coverage : US-ASCII, Thai (U+0E00-U+0E07F), punctuation marks
# U+2018, U+2019, U+201c, U+201d, U+2022, U+2013, U+2014 )
#
# These familes of fonts and other fonts with the same PUA assignment
# are included as a part of Thai language support in most Linux distributions.
encoding.norasi.ttf = x-thaittf-0.wide
encoding.garuda.ttf = x-thaittf-0.wide
encoding.dbthaitext.ttf = x-thaittf-0.wide
# SunIndic fonts.
# glyph arrangement : Nominal glyphs for Indic scripts at their Unicode code
# points along with presentation forms in PUA
# coverage : US-ASCII, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya,
# Tamil, Telugu, Kanada, Malayalam
# Note : Currently only Devanagari is supported with this encoding.
# Two fonts in this family is available for free download at
# <http://www.sun.com/developers/gadc>.
encoding.saraswati5.ttf = x-sun-unicode-india-0.wide

File diff suppressed because it is too large Load Diff

View File

@ -50,8 +50,9 @@
class nsFontXft;
typedef void (*GlyphEnumeratorCallback) (FcChar32 aChar, nsFontXft *aFont,
void *aData);
typedef nsresult (*GlyphEnumeratorCallback) (const FcChar32 *aString,
PRUint32 aLen, nsFontXft *aFont,
void *aData);
class nsFontMetricsXft : public nsIFontMetricsGTK
{
@ -207,12 +208,14 @@ public:
static nsresult FamilyExists (nsIDeviceContext *aDevice,
const nsString &aName);
void DrawStringCallback (FcChar32 aChar, nsFontXft *aFont,
void *aData);
void TextDimensionsCallback (FcChar32 aChar, nsFontXft *aFont,
void *aData);
void GetWidthCallback (FcChar32 aChar, nsFontXft *aFont,
void *aData);
nsresult DrawStringCallback (const FcChar32 *aString, PRUint32 aLen,
nsFontXft *aFont, void *aData);
nsresult TextDimensionsCallback (const FcChar32 *aString, PRUint32 aLen,
nsFontXft *aFont, void *aData);
nsresult GetWidthCallback (const FcChar32 *aString, PRUint32 aLen,
nsFontXft *aFont, void *aData);
nsresult BoundingMetricsCallback (const FcChar32 *aString, PRUint32 aLen,
nsFontXft *aFont, void *aData);
private:
// local methods
@ -230,7 +233,7 @@ private:
nscoord aY,
XftColor *aColor,
XftDraw *aDraw);
void EnumerateGlyphs (FcChar32 *aChars,
nsresult EnumerateGlyphs (const FcChar32 *aString,
PRUint32 aLen,
GlyphEnumeratorCallback aCallback,
void *aCallbackData);