More build goop to get pango building. Add the right calls so that RTL info is passed down. r+sr=bryner

This commit is contained in:
blizzard%redhat.com 2004-08-02 20:50:01 +00:00
Родитель d188385278
Коммит aa8be61c26
13 изменённых файлов: 130 добавлений и 71 удалений

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

@ -406,6 +406,10 @@ MOZ_XFT_CFLAGS = @MOZ_XFT_CFLAGS@
MOZ_XFT_LIBS = @MOZ_XFT_LIBS@
MOZ_ENABLE_COREXFONTS = @MOZ_ENABLE_COREXFONTS@
MOZ_ENABLE_PANGO = @MOZ_ENABLE_PANGO@
MOZ_PANGO_CFLAGS = @MOZ_PANGO_CFLAGS@
MOZ_PANGO_LIBS = @MOZ_PANGO_LIBS@
MOZ_EXTRA_X11CONVERTERS = @MOZ_EXTRA_X11CONVERTERS@
MOZ_ENABLE_XINERAMA = @MOZ_ENABLE_XINERAMA@

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

@ -3454,6 +3454,34 @@ AC_SUBST(MOZ_ENABLE_XFT)
AC_SUBST(MOZ_XFT_CFLAGS)
AC_SUBST(MOZ_XFT_LIBS)
dnl ========================================================
dnl = pango font rendering
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(pango,
[ --enable-pango Enable Pango font rendering support],
MOZ_ENABLE_PANGO=1,
MOZ_ENABLE_PANGO=)
if test "$MOZ_ENABLE_PANGO"
then
AC_DEFINE(MOZ_ENABLE_PANGO)
PKG_CHECK_MODULES(MOZ_PANGO, pango >= 1.5.0)
dnl Make sure that the pango version is _actually_ new enough
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
CFLAGS="$MOZ_PANGO_CFLAGS $CFLAGS"
LDFLAGS="$MOZ_PANGO_LIBS $LDFLAGS"
AC_CHECK_LIB(pangoft2-1.0, pango_fc_font_map_add_decoder_find_func,,
AC_MSG_ERROR([Your Pango is too old. Sorry.]))
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
AC_SUBST(MOZ_ENABLE_PANGO)
AC_SUBST(MOZ_PANGO_CFLAGS)
AC_SUBST(MOZ_PANGO_LIBS)
fi
dnl ========================================================
dnl = disabling x11 core support, enabled by default
dnl ========================================================

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

@ -4599,6 +4599,12 @@ nsFontMetricsGTK::GetCurrentGDKFont(void)
return mCurrentFont->GetGDKFont();
}
nsresult
nsFontMetricsGTK::SetRightToLeftText(PRBool aIsRTL)
{
return NS_OK;
}
PR_BEGIN_EXTERN_C
static int
CompareSizes(const void* aArg1, const void* aArg2, void *data)

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

@ -343,6 +343,8 @@ public:
virtual GdkFont* GetCurrentGDKFont(void);
virtual nsresult SetRightToLeftText(PRBool aIsRTL);
static nsresult FamilyExists(nsIDeviceContext *aDevice, const nsString& aName);
static PRUint32 GetHints(void);

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

@ -50,11 +50,20 @@
#include "nsFontMetricsGTK.h"
#endif
#ifdef MOZ_ENABLE_PANGO
#include "nsFontMetricsPango.h"
#endif
#include "nsFontMetricsUtils.h"
PRUint32
NS_FontMetricsGetHints(void)
{
#ifdef MOZ_ENABLE_PANGO
if (NS_IsPangoEnabled()) {
return nsFontMetricsPango::GetHints();
}
#endif
#ifdef MOZ_ENABLE_XFT
if (NS_IsXftEnabled()) {
return nsFontMetricsXft::GetHints();
@ -69,6 +78,11 @@ NS_FontMetricsGetHints(void)
nsresult
NS_FontMetricsFamilyExists(nsIDeviceContext *aDevice, const nsString &aName)
{
#ifdef MOZ_ENABLE_PANGO
if (NS_IsPangoEnabled()) {
return nsFontMetricsPango::FamilyExists(aDevice, aName);
}
#endif
#ifdef MOZ_ENABLE_XFT
// try to fall through to the core fonts if xft fails
if (NS_IsXftEnabled()) {
@ -121,3 +135,17 @@ NS_IsXftEnabled(void)
}
#endif /* MOZ_ENABLE_XFT */
#ifdef MOZ_ENABLE_PANGO
PRBool
NS_IsPangoEnabled(void)
{
char *val = PR_GetEnv("MOZ_DISABLE_PANGO");
if (val)
return FALSE;
return TRUE;
}
#endif

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

@ -42,9 +42,12 @@
extern PRUint32 NS_FontMetricsGetHints (void);
extern nsresult NS_FontMetricsFamilyExists(nsIDeviceContext *aDevice,
const nsString &aName);
#ifdef MOZ_ENABLE_XFT
extern PRBool NS_IsXftEnabled(void);
#endif
#ifdef MOZ_ENABLE_PANGO
extern PRBool NS_IsPangoEnabled(void);
#endif
#endif /* __nsFontMetricsUtils_h */

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

@ -449,7 +449,7 @@ nsFontMetricsXft::Init(const nsFont& aFont, nsIAtom* aLangGroup,
// Make sure that the pixel size is at least greater than zero
if (mPixelSize < 1) {
#ifdef DEBUG
printf("*** Warning: nsFontMetricsXft was passed a pixel size of %d\n",
printf("*** Warning: nsFontMetricsXft was passed a pixel size of %f\n",
mPixelSize);
#endif
mPixelSize = 1;
@ -766,6 +766,12 @@ nsFontMetricsXft::GetCurrentGDKFont(void)
return nsnull;
}
nsresult
nsFontMetricsXft::SetRightToLeftText(PRBool aIsRTL)
{
return NS_OK;
}
PRUint32
nsFontMetricsXft::GetHints(void)
{

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

@ -202,6 +202,8 @@ public:
virtual GdkFont* GetCurrentGDKFont(void);
virtual nsresult SetRightToLeftText(PRBool aIsRTL);
// get hints for the font
static PRUint32 GetHints (void);

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

@ -248,98 +248,42 @@ void nsGCCache::ReuseGC(GCCacheEntry *entry, GdkGCValues *gcv, GdkGCValuesMask f
// We have old GC, reuse it and check what
// we have to change
XGCValues xvalues;
unsigned long xvalues_mask=0;
GdkGCValues xvalues;
int xvalues_mask = 0;
if (entry->clipRegion) {
// set it to none here and then set the clip region with
// gdk_gc_set_clip_region in GetGC()
xvalues.clip_mask = None;
xvalues_mask |= GCClipMask;
xvalues_mask |= GDK_GC_CLIP_MASK;
gdk_region_destroy(entry->clipRegion);
entry->clipRegion = NULL;
}
if (entry->gcv.foreground.pixel != gcv->foreground.pixel) {
xvalues.foreground = gcv->foreground.pixel;
xvalues_mask |= GCForeground;
xvalues.foreground.pixel = gcv->foreground.pixel;
xvalues_mask |= GDK_GC_FOREGROUND;
}
if (entry->gcv.function != gcv->function) {
switch (gcv->function) {
case GDK_COPY:
xvalues.function = GXcopy;
break;
case GDK_INVERT:
xvalues.function = GXinvert;
break;
case GDK_XOR:
xvalues.function = GXxor;
break;
case GDK_CLEAR:
xvalues.function = GXclear;
break;
case GDK_AND:
xvalues.function = GXand;
break;
case GDK_AND_REVERSE:
xvalues.function = GXandReverse;
break;
case GDK_AND_INVERT:
xvalues.function = GXandInverted;
break;
case GDK_NOOP:
xvalues.function = GXnoop;
break;
case GDK_OR:
xvalues.function = GXor;
break;
case GDK_EQUIV:
xvalues.function = GXequiv;
break;
case GDK_OR_REVERSE:
xvalues.function = GXorReverse;
break;
case GDK_COPY_INVERT:
xvalues.function = GXcopyInverted;
break;
case GDK_OR_INVERT:
xvalues.function = GXorInverted;
break;
case GDK_NAND:
xvalues.function = GXnand;
break;
case GDK_SET:
xvalues.function = GXset;
break;
}
xvalues_mask |= GCFunction;
xvalues.function = gcv->function;
xvalues_mask |= GDK_GC_FUNCTION;
}
if(entry->gcv.font != gcv->font && flags & GDK_GC_FONT) {
xvalues.font = ((XFontStruct *)GDK_FONT_XFONT(gcv->font))->fid;
xvalues_mask |= GCFont;
xvalues.font = gcv->font;
xvalues_mask |= GDK_GC_FONT;
}
if (entry->gcv.line_style != gcv->line_style) {
switch (gcv->line_style) {
case GDK_LINE_SOLID:
xvalues.line_style = LineSolid;
break;
case GDK_LINE_ON_OFF_DASH:
xvalues.line_style = LineOnOffDash;
break;
case GDK_LINE_DOUBLE_DASH:
xvalues.line_style = LineDoubleDash;
break;
}
xvalues_mask |= GCLineStyle;
xvalues.line_style = gcv->line_style;
xvalues_mask |= GDK_GC_LINE_STYLE;
}
if (xvalues_mask != 0) {
XChangeGC(GDK_GC_XDISPLAY(entry->gc), GDK_GC_XGC(entry->gc),
xvalues_mask, &xvalues);
gdk_gc_set_values(entry->gc, &xvalues, (GdkGCValuesMask)xvalues_mask);
}
entry->flags = flags;
entry->gcv = *gcv;
}

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

@ -61,6 +61,9 @@
#ifdef NATIVE_THEME_SUPPORT
#include "nsNativeThemeGTK.h"
#endif
#ifdef MOZ_ENABLE_PANGO
#include "nsFontMetricsPango.h"
#endif
#ifdef MOZ_ENABLE_XFT
#include "nsFontMetricsXft.h"
#endif
@ -111,6 +114,13 @@ nsFontMetricsConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
#ifdef MOZ_ENABLE_PANGO
if (NS_IsPangoEnabled()) {
result = new nsFontMetricsPango();
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
} else {
#endif
#ifdef MOZ_ENABLE_XFT
if (NS_IsXftEnabled()) {
result = new nsFontMetricsXft();
@ -126,6 +136,9 @@ nsFontMetricsConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
#ifdef MOZ_ENABLE_XFT
}
#endif
#ifdef MOZ_ENABLE_PANGO
}
#endif
NS_ADDREF(result);
nsresult rv = result->QueryInterface(aIID, aResult);
@ -147,6 +160,13 @@ nsFontEnumeratorConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
#ifdef MOZ_ENABLE_PANGO
if (NS_IsPangoEnabled()) {
result = new nsFontEnumeratorPango();
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
} else {
#endif
#ifdef MOZ_ENABLE_XFT
if (NS_IsXftEnabled()) {
result = new nsFontEnumeratorXft();
@ -162,6 +182,9 @@ nsFontEnumeratorConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
#ifdef MOZ_ENABLE_XFT
}
#endif
#ifdef MOZ_ENABLE_PANGO
}
#endif
NS_ADDREF(result);
nsresult rv = result->QueryInterface(aIID, aResult);

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

@ -121,6 +121,9 @@ public:
// particular handle.
virtual GdkFont* GetCurrentGDKFont(void) = 0;
// Set the direction of the text rendering
virtual nsresult SetRightToLeftText(PRBool aIsRTL) = 0;
};
#endif /* __nsIFontMetricsGTK_h */

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

@ -548,6 +548,9 @@ void nsRenderingContextGTK::UpdateGC()
values.foreground.pixel =
gdk_rgb_xpixel_from_rgb(NS_TO_GDK_RGB(mCurrentColor));
values.foreground.red = (NS_GET_R(mCurrentColor) << 8) | NS_GET_R(mCurrentColor);
values.foreground.green = (NS_GET_G(mCurrentColor) << 8) | NS_GET_G(mCurrentColor);
values.foreground.blue = (NS_GET_B(mCurrentColor) << 8) | NS_GET_B(mCurrentColor);
valuesMask = GDK_GC_FOREGROUND;
#ifdef MOZ_ENABLE_COREXFONTS
@ -1440,6 +1443,11 @@ nsRenderingContextGTK::GetBoundingMetrics(const PRUnichar* aString,
#endif /* MOZ_MATHML */
NS_IMETHODIMP nsRenderingContextGTK::SetRightToLeftText(PRBool aIsRTL)
{
return mFontMetrics->SetRightToLeftText(aIsRTL);
}
NS_IMETHODIMP nsRenderingContextGTK::DrawImage(imgIContainer *aImage, const nsRect & aSrcRect, const nsRect & aDestRect)
{
UpdateGC();

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

@ -192,6 +192,8 @@ public:
const nsRect &aDestBounds, PRUint32 aCopyFlags);
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd);
NS_IMETHOD SetRightToLeftText(PRBool aIsRTL);
NS_IMETHOD DrawImage(imgIContainer *aImage, const nsRect & aSrcRect, const nsRect & aDestRect);
NS_IMETHOD GetBackbuffer(const nsRect &aRequestedSize, const nsRect &aMaxSize, nsIDrawingSurface* &aBackbuffer);