backing out 362682 due to linux tinderboxen not being upgraded... (396805, 389426)

This commit is contained in:
pavlov@pavlov.net 2007-09-19 16:53:09 -07:00
Родитель 309e7d7b07
Коммит baa8d2e6cb
8 изменённых файлов: 897 добавлений и 228 удалений

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

@ -213,7 +213,6 @@ Gdiplus.h
gdk/gdkevents.h
gdk/gdk.h
gdk/gdkkeysyms.h
gdk/gdkpango.h
gdk/gdkprivate.h
gdk/gdkregion.h
gdk/gdkwindow.h
@ -506,7 +505,6 @@ PALM_CMN.H
pango-engine.h
pango-glyph.h
pango-modules.h
pango/pangocairo.h
pango/pangofc-decoder.h
pango/pangofc-font.h
pango/pangofc-fontmap.h
@ -515,7 +513,6 @@ pango/pango-fontmap.h
pango/pango.h
pango/pangoxft.h
pango/pangox.h
pango/pango-utils.h
pango-types.h
pascal.h
Patches.h

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

@ -116,8 +116,7 @@ PERL_VERSION=5.006
LIBART_VERSION=2.3.4
CAIRO_VERSION=1.4.2
GLITZ_VERSION=0.4.0
PANGO_VERSION=1.10.0
GTK2_VERSION=1.8.0
GTK2_VERSION=1.3.7
MAKE_VERSION=3.78
WINDRES_VERSION=2.14.90
W32API_VERSION=3.8
@ -4568,7 +4567,7 @@ fi
if test "$COMPILE_ENVIRONMENT"; then
if test "$MOZ_ENABLE_GTK2"
then
PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gdk-x11-2.0 glib-2.0 gobject-2.0)
PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= 1.3.7 gdk-x11-2.0 glib-2.0 gobject-2.0)
fi
fi # COMPILE_ENVIRONMENT
@ -4807,7 +4806,7 @@ if test "$MOZ_ENABLE_XFT"
then
AC_DEFINE(MOZ_ENABLE_XFT)
PKG_CHECK_MODULES(MOZ_XFT, xft)
PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
PKG_CHECK_MODULES(_PANGOCHK, pango >= 1.1.0)
fi
AC_SUBST(MOZ_ENABLE_XFT)
@ -4824,7 +4823,12 @@ MOZ_ARG_ENABLE_BOOL(pango,
if test "$MOZ_ENABLE_PANGO" && test -z "$MOZ_ENABLE_CAIRO_GFX"
then
AC_MSG_ERROR([Cairo gfx is required for Pango font rendering])
AC_DEFINE(MOZ_ENABLE_PANGO)
PKG_CHECK_MODULES(MOZ_PANGO, pangoxft >= 1.6.0)
AC_SUBST(MOZ_ENABLE_PANGO)
AC_SUBST(MOZ_PANGO_CFLAGS)
AC_SUBST(MOZ_PANGO_LIBS)
fi
if test "$MOZ_ENABLE_GTK2" && test "$MOZ_ENABLE_CAIRO_GFX"
@ -4840,7 +4844,13 @@ fi
if test "$MOZ_ENABLE_PANGO" && test "$MOZ_ENABLE_CAIRO_GFX"
then
AC_DEFINE(MOZ_ENABLE_PANGO)
PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
dnl PKG_CHECK_MODULES(MOZ_PANGO, pango >= 1.10.0 pangocairo >= 1.10.0)
if test "$MOZ_X11"; then
PKG_CHECK_MODULES(MOZ_PANGO, pango >= 1.6.0 pangoft2 >= 1.6.0 pangoxft >= 1.6.0)
else
PKG_CHECK_MODULES(MOZ_PANGO, pango >= 1.6.0 pangoft2 >= 1.6.0)
fi
AC_SUBST(MOZ_ENABLE_PANGO)
AC_SUBST(MOZ_PANGO_CFLAGS)
AC_SUBST(MOZ_PANGO_LIBS)

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

@ -1097,9 +1097,7 @@ _render_glyph_bitmap (FT_Face face,
* we avoid the FT_LOAD_NO_RECURSE flag.
*/
error = FT_Render_Glyph (glyphslot, FT_RENDER_MODE_NORMAL);
/* XXX ignoring all other errors for now. They are not fatal, typically
* just a glyph-not-found. */
if (error == FT_Err_Out_Of_Memory) {
if (error) {
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return CAIRO_STATUS_NO_MEMORY;
}
@ -1893,9 +1891,8 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
error = FT_Load_Glyph (scaled_font->unscaled->face,
_cairo_scaled_glyph_index(scaled_glyph),
load_flags);
/* XXX ignoring all other errors for now. They are not fatal, typically
* just a glyph-not-found. */
if (error == FT_Err_Out_Of_Memory) {
if (error) {
status = CAIRO_STATUS_NO_MEMORY;
goto FAIL;
}
@ -2045,9 +2042,8 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
error = FT_Load_Glyph (face,
_cairo_scaled_glyph_index(scaled_glyph),
load_flags | FT_LOAD_NO_BITMAP);
/* XXX ignoring all other errors for now. They are not fatal, typically
* just a glyph-not-found. */
if (error == FT_Err_Out_Of_Memory) {
if (error) {
_cairo_ft_unscaled_font_unlock_face (unscaled);
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return CAIRO_STATUS_NO_MEMORY;

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

@ -44,15 +44,14 @@
#include "gfxFont.h"
#include <pango/pango.h>
#include <X11/Xft/Xft.h>
// Control when we bypass Pango
// Enable this to use FreeType to glyph-convert 8bit-only textruns, but use Pango
// Control when we use Xft directly, bypassing Pango
// Enable this to use Xft to glyph-convert 8bit-only textruns, but use Pango
// to shape any textruns with non-8bit characters
// XXX
#define ENABLE_FAST_PATH_8BIT
// Enable this to bypass Pango shaping for all textruns. Don't expect
// anything other than simple Latin work though!
//#define ENABLE_FAST_PATH_ALWAYS
#define ENABLE_XFT_FAST_PATH_8BIT
// Enable this to use Xft to glyph-convert all textruns
// #define ENABLE_XFT_FAST_PATH_ALWAYS
#include "nsDataHashtable.h"
#include "nsClassHashtable.h"
@ -71,15 +70,17 @@ public:
virtual const gfxFont::Metrics& GetMetrics();
PangoFontDescription *GetPangoFontDescription() { if (!mPangoFontDesc) RealizeFont(); return mPangoFontDesc; }
PangoContext *GetPangoContext() { if (!mPangoFontDesc) RealizeFont(); return mPangoCtx; }
PangoFontDescription *GetPangoFontDescription() { RealizeFont(); return mPangoFontDesc; }
PangoContext *GetPangoContext() { RealizeFont(); return mPangoCtx; }
void GetMozLang(nsACString &aMozLang);
void GetActualFontFamily(nsACString &aFamily);
PangoFont *GetPangoFont() { if (!mPangoFont) RealizePangoFont(); return mPangoFont; }
gfxFloat GetAdjustedSize() { if (!mPangoFontDesc) RealizeFont(); return mAdjustedSize; }
XftFont *GetXftFont () { RealizeXftFont (); return mXftFont; }
PangoFont *GetPangoFont() { RealizePangoFont(); return mPangoFont; }
gfxFloat GetAdjustedSize() { RealizeFont(); return mAdjustedSize; }
PRBool HasGlyph(const PRUint32 aChar);
PRUint32 GetGlyph(const PRUint32 aChar);
virtual nsString GetUniqueName();
@ -94,7 +95,9 @@ protected:
PangoFontDescription *mPangoFontDesc;
PangoContext *mPangoCtx;
XftFont *mXftFont;
PangoFont *mPangoFont;
PangoFont *mGlyphTestingFont;
cairo_scaled_font_t *mCairoFont;
PRBool mHasMetrics;
@ -103,6 +106,7 @@ protected:
gfxFloat mAdjustedSize;
void RealizeFont(PRBool force = PR_FALSE);
void RealizeXftFont(PRBool force = PR_FALSE);
void RealizePangoFont(PRBool aForce = PR_FALSE);
void GetCharSize(const char aChar, gfxSize& aInkSize, gfxSize& aLogSize,
PRUint32 *aGlyphID = nsnull);
@ -120,7 +124,7 @@ public:
virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle);
// Create and initialize a textrun using Pango
// Create and initialize a textrun using Pango (or Xft)
virtual gfxTextRun *MakeTextRun(const PRUnichar *aString, PRUint32 aLength,
const Parameters *aParams, PRUint32 aFlags);
virtual gfxTextRun *MakeTextRun(const PRUint8 *aString, PRUint32 aLength,
@ -142,8 +146,8 @@ protected:
* but stored in UTF16 format)
*/
void InitTextRun(gfxTextRun *aTextRun, const gchar *aUTF8Text,
PRUint32 aUTF8Length, PRBool aTake8BitPath);
PRUint32 aUTF8Length, PRUint32 aUTF8HeaderLength,
PRBool aTake8BitPath);
// Returns NS_ERROR_FAILURE if there's a missing glyph
nsresult SetGlyphs(gfxTextRun *aTextRun, gfxPangoFont *aFont,
const gchar *aUTF8, PRUint32 aUTF8Length,
@ -154,11 +158,11 @@ protected:
const gchar *aUTF8, PRUint32 aUTF8Length,
PRUint32 *aUTF16Offset);
void CreateGlyphRunsItemizing(gfxTextRun *aTextRun,
const gchar *aUTF8, PRUint32 aUTF8Length);
#if defined(ENABLE_FAST_PATH_8BIT) || defined(ENABLE_FAST_PATH_ALWAYS)
PRBool CanTakeFastPath(PRUint32 aFlags);
void CreateGlyphRunsFast(gfxTextRun *aTextRun,
const gchar *aUTF8, PRUint32 aUTF8Length);
const gchar *aUTF8, PRUint32 aUTF8Length,
PRUint32 aUTF8HeaderLength);
#if defined(ENABLE_XFT_FAST_PATH_8BIT) || defined(ENABLE_XFT_FAST_PATH_ALWAYS)
void CreateGlyphRunsXft(gfxTextRun *aTextRun,
const gchar *aUTF8, PRUint32 aUTF8Length);
#endif
static PRBool FontCallback (const nsAString& fontName,
@ -208,4 +212,30 @@ private:
nsClassHashtable<nsUint32HashKey, gfxPangoFontWrapper> mPangoFonts;
};
// XXX we should remove this class, because this class is used only in |HasGlyph| of gfxPangoFont.
// But it can use fontconfig directly after bug 366664.
class gfxPangoFontNameMap
{
public:
gfxPangoFontNameMap();
~gfxPangoFontNameMap();
static gfxPangoFontNameMap* GetPangoFontNameMap() {
if (!sPangoFontNameMap)
sPangoFontNameMap = new gfxPangoFontNameMap();
return sPangoFontNameMap;
}
static void Shutdown() {
if (sPangoFontNameMap)
delete sPangoFontNameMap;
sPangoFontNameMap = nsnull;
}
void Put(const nsACString &aName, PangoFont *aPangoFont);
PangoFont* Get(const nsACString &aName);
private:
static gfxPangoFontNameMap *sPangoFontNameMap;
nsClassHashtable<nsCStringHashKey, gfxPangoFontWrapper> mPangoFonts;
};
#endif /* GFX_PANGOFONTS_H */

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

@ -79,7 +79,7 @@ public:
if (sDPI == -1) {
InitDPI();
}
NS_ASSERTION(sDPI > 0, "Something is wrong");
NS_ASSERTION(sDPI != 0, "Something is wrong");
return sDPI;
}

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

@ -40,7 +40,6 @@
#include "cairo-xlib.h"
#include <stdlib.h>
#include <stdint.h>
#if HAVE_STDINT_H
#include <stdint.h>
#elif HAVE_INTTYPES_H

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -60,6 +60,12 @@
#include <fontconfig/fontconfig.h>
#ifndef THEBES_USE_PANGO_CAIRO
#include <pango/pangoxft.h>
#endif // THEBES_USE_PANGO_CAIRO
#include <pango/pango-font.h>
#include "nsMathUtils.h"
#include "lcms.h"
@ -83,8 +89,6 @@ gfxPlatformGtk::gfxPlatformGtk()
#endif
if (!sFontconfigUtils)
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
InitDPI();
}
gfxPlatformGtk::~gfxPlatformGtk()
@ -94,6 +98,10 @@ gfxPlatformGtk::~gfxPlatformGtk()
gfxPangoFont::Shutdown();
#ifndef THEBES_USE_PANGO_CAIRO
pango_xft_shutdown_display(GDK_DISPLAY(), 0);
#endif
#if 0
// It would be nice to do this (although it might need to be after
// the cairo shutdown that happens in ~gfxPlatform). It even looks
@ -270,17 +278,93 @@ gfxPlatformGtk::CreateFontGroup(const nsAString &aFamilies,
return new gfxPangoFontGroup(aFamilies, aStyle);
}
static PRInt32
GetXftDPI()
{
char *val = XGetDefault(GDK_DISPLAY(), "Xft", "dpi");
if (val) {
char *e;
double d = strtod(val, &e);
if (e != val)
return NS_lround(d);
}
return -1;
}
static PRInt32
GetDPIFromPangoFont()
{
#ifndef THEBES_USE_PANGO_CAIRO
PangoContext* ctx = pango_xft_get_context(GDK_DISPLAY(), 0);
gdk_pango_context_set_colormap(ctx, gdk_rgb_get_cmap());
#else
PangoContext* ctx =
pango_cairo_font_map_create_context(
PANGO_CAIRO_FONT_MAP(pango_cairo_font_map_get_default()));
#endif
if (!ctx) {
return 0;
}
double dblDPI = 0.0f;
GList *items = nsnull;
PangoItem *item = nsnull;
PangoFcFont *fcfont = nsnull;
PangoAttrList *al = pango_attr_list_new();
if (!al) {
goto cleanup;
}
// Just using the string "a" because we need _some_ text.
items = pango_itemize(ctx, "a", 0, 1, al, NULL);
if (!items) {
goto cleanup;
}
item = (PangoItem*)items->data;
if (!item) {
goto cleanup;
}
fcfont = PANGO_FC_FONT(item->analysis.font);
if (!fcfont) {
goto cleanup;
}
FcPatternGetDouble(fcfont->font_pattern, FC_DPI, 0, &dblDPI);
cleanup:
if (al)
pango_attr_list_unref(al);
if (item)
pango_item_free(item);
if (items)
g_list_free(items);
if (ctx)
g_object_unref(ctx);
return NS_lround(dblDPI);
}
/* static */
void
gfxPlatformGtk::InitDPI()
{
PangoContext *context = gdk_pango_context_get ();
sDPI = pango_cairo_context_get_resolution (context);
g_object_unref (context);
sDPI = GetXftDPI();
if (sDPI <= 0) {
// Fall back to something sane
sDPI = 96;
sDPI = GetDPIFromPangoFont();
if (sDPI <= 0) {
// Fall back to something sane
sDPI = 96;
}
}
}