summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2000-08-20 22:02:14 +0000
committerTor Lillqvist <tml@src.gnome.org>2000-08-20 22:02:14 +0000
commitcd3238a63b904fd0792ca04f1dac7ff04ef98eb4 (patch)
tree20e3507658937baaf610ef3a48bac98439672255 /pango
parent1c7f0ddea0ef2f9471a1dd87cebee30443524bd6 (diff)
downloadpango-cd3238a63b904fd0792ca04f1dac7ff04ef98eb4.tar.gz
Handle also ft_pixel_mode_mono glyphs.
2000-08-21 Tor Lillqvist <tml@iki.fi> * pango/pangoft2.c (pango_ft2_render): Handle also ft_pixel_mode_mono glyphs. * pango/pangoft2*: Portability enhancements (non-gcc). * examples/viewer-{ft2,win32}.c: One more 1000 vs. PANGO_SCALE fix. * pango/module-defs.c.win32: New file. * pango/Makefile.am: Distribute it.
Diffstat (limited to 'pango')
-rw-r--r--pango/Makefile.am1
-rw-r--r--pango/module-defs.c.win327
-rw-r--r--pango/pangoft2-fontcache.c2
-rw-r--r--pango/pangoft2-fontmap.c7
-rw-r--r--pango/pangoft2-private.h6
-rw-r--r--pango/pangoft2.c54
-rw-r--r--pango/pangowin32-private.h7
7 files changed, 69 insertions, 15 deletions
diff --git a/pango/Makefile.am b/pango/Makefile.am
index df653b17..fb19cd43 100644
--- a/pango/Makefile.am
+++ b/pango/Makefile.am
@@ -67,6 +67,7 @@ pango_querymodules_SOURCES = \
pango_querymodules_LDADD = libpangox.la libpango.la $(GLIB_LIBS) $(FRIBIDI_LIBS) $(UNICODE_LIBS) $(X_LIBS)
EXTRA_DIST = \
+ module-defs.c.win32 \
pangowin32.h \
pangowin32.c \
pangowin32-private.h \
diff --git a/pango/module-defs.c.win32 b/pango/module-defs.c.win32
new file mode 100644
index 00000000..68cb3ead
--- /dev/null
+++ b/pango/module-defs.c.win32
@@ -0,0 +1,7 @@
+/* Hand-written for Win32. */
+
+#include "modules.h"
+
+PangoIncludedModule _pango_included_modules[] = {
+ { NULL, NULL, NULL },
+};
diff --git a/pango/pangoft2-fontcache.c b/pango/pangoft2-fontcache.c
index 4f7f82b5..62e0f96c 100644
--- a/pango/pangoft2-fontcache.c
+++ b/pango/pangoft2-fontcache.c
@@ -21,6 +21,8 @@
#include "pangoft2-private.h"
+#include <string.h>
+
/* Font cache
*/
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c
index a81c8639..a3e99c5d 100644
--- a/pango/pangoft2-fontmap.c
+++ b/pango/pangoft2-fontmap.c
@@ -21,6 +21,7 @@
#include "config.h"
+#include <glib.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,6 +36,12 @@
#include "pango-utils.h"
#include "pangoft2-private.h"
+#ifdef G_OS_WIN32
+#ifndef S_ISREG
+#define S_ISREG(mode) ((mode) & _S_IFREG)
+#endif
+#endif
+
#define PANGO_TYPE_FT2_FONT_MAP (pango_ft2_font_map_get_type ())
#define PANGO_FT2_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FT2_FONT_MAP, PangoFT2FontMap))
#define PANGO_FT2_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FT2_FONT_MAP, PangoFT2FontMapClass))
diff --git a/pango/pangoft2-private.h b/pango/pangoft2-private.h
index 92b1c053..96be9343 100644
--- a/pango/pangoft2-private.h
+++ b/pango/pangoft2-private.h
@@ -29,10 +29,16 @@
#define DEBUGGING 1
#ifdef DEBUGGING
+#ifdef __GNUC__
#define PING(printlist) \
(g_print ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \
g_print printlist)
#else
+#define PING(printlist) \
+(g_print ("%s:%d ", __FILE__, __LINE__), \
+ g_print printlist)
+#endif
+#else
#define PING(printlist)
#endif
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index faffe580..fe55178c 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -317,21 +317,45 @@ pango_ft2_render (FT_Bitmap *bitmap,
PING (("xstart:%d xlim:%d ystart:%d ylim:%d\n",
x_start, x_limit, y_start, y_limit));
- for (iy = y_start; iy < y_limit; iy++)
- {
- p = bitmap->buffer +
- (iyoff - face->glyph->bitmap_top + iy) * bitmap->pitch +
- ixoff +
- face->glyph->bitmap_left + x_start;
-
- q = face->glyph->bitmap.buffer + iy*face->glyph->bitmap.pitch;
- for (ix = x_start; ix < x_limit; ix++)
- {
- *p = MIN (*p, 0xFF - *q);
- q++;
- p++;
- }
- }
+ if (face->glyph->bitmap.pixel_mode == ft_pixel_mode_grays)
+ for (iy = y_start; iy < y_limit; iy++)
+ {
+ p = bitmap->buffer +
+ (iyoff - face->glyph->bitmap_top + iy) * bitmap->pitch +
+ ixoff +
+ face->glyph->bitmap_left + x_start;
+
+ q = face->glyph->bitmap.buffer + iy*face->glyph->bitmap.pitch;
+ for (ix = x_start; ix < x_limit; ix++)
+ {
+ *p = MIN (*p, 0xFF - *q);
+ q++;
+ p++;
+ }
+ }
+ else if (face->glyph->bitmap.pixel_mode == ft_pixel_mode_mono)
+ for (iy = y_start; iy < y_limit; iy++)
+ {
+ p = bitmap->buffer +
+ (iyoff - face->glyph->bitmap_top + iy) * bitmap->pitch +
+ ixoff +
+ face->glyph->bitmap_left + x_start;
+
+ q = face->glyph->bitmap.buffer + iy*face->glyph->bitmap.pitch;
+ for (ix = x_start; ix < x_limit; ix++)
+ {
+ if ((*q) & (1 << (7 - (ix%8))))
+ *p = 0;
+ else
+ *p = MIN (*p, 0xFF);
+ if ((ix%8) == 7)
+ q++;
+ p++;
+ }
+ }
+ else
+ g_warning ("pango_ft2_render: Unrecognized glyph bitmap pixel mode %d\n",
+ face->glyph->bitmap.pixel_mode);
prev_face = face;
prev_index = glyph_index;
diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h
index 84d1963d..08ab4ac2 100644
--- a/pango/pangowin32-private.h
+++ b/pango/pangowin32-private.h
@@ -23,10 +23,17 @@
#define __PANGOWIN32_PRIVATE_H__
/* Just for debugging, will be removed */
+#ifdef __GNUC__
#define PING(printlist) \
(g_print ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \
g_print printlist, \
g_print ("\n"))
+#else
+#define PING(printlist) \
+(g_print ("%s:%d ", __FILE__, __LINE__), \
+ g_print printlist, \
+ g_print ("\n"))
+#endif
#include "pango-modules.h"
#include "pangowin32.h"