summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Neumann <sven@gimp.org>2003-04-03 11:15:38 +0000
committerSven Neumann <neo@src.gnome.org>2003-04-03 11:15:38 +0000
commita5961bac22c6d37ee81656501ab6d6652ea5ac1b (patch)
tree803960f8ed4c45fa284b6943380946fd0d69ad37
parent1be1e82c819fa0aab370e3bc3a17dc320d93beca (diff)
downloadpango-a5961bac22c6d37ee81656501ab6d6652ea5ac1b.tar.gz
disable antialiasing if requested. Fixes bug #109370.
2003-04-03 Sven Neumann <sven@gimp.org> * pango/pangoft2.c (pango_ft2_font_get_face) (pango_ft2_font_render_glyph): disable antialiasing if requested. Fixes bug #109370. * pango/pangoft2.c (pango_ft2_render): fixed rendering of monochrome bitmaps.
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.pre-1-109
-rw-r--r--ChangeLog.pre-1-49
-rw-r--r--ChangeLog.pre-1-69
-rw-r--r--ChangeLog.pre-1-89
-rw-r--r--pango/pangoft2.c43
6 files changed, 75 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 69cd0c2f..4de4069c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-04-03 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_font_get_face)
+ (pango_ft2_font_render_glyph): disable antialiasing if requested.
+ Fixes bug #109370.
+
+ * pango/pangoft2.c (pango_ft2_render): fixed rendering of
+ monochrome bitmaps.
+
2003-04-02 Sven Neumann <sven@gimp.org>
* pango/pangoft2.c (pango_ft2_render_layout)
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 69cd0c2f..4de4069c 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,12 @@
+2003-04-03 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_font_get_face)
+ (pango_ft2_font_render_glyph): disable antialiasing if requested.
+ Fixes bug #109370.
+
+ * pango/pangoft2.c (pango_ft2_render): fixed rendering of
+ monochrome bitmaps.
+
2003-04-02 Sven Neumann <sven@gimp.org>
* pango/pangoft2.c (pango_ft2_render_layout)
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 69cd0c2f..4de4069c 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,12 @@
+2003-04-03 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_font_get_face)
+ (pango_ft2_font_render_glyph): disable antialiasing if requested.
+ Fixes bug #109370.
+
+ * pango/pangoft2.c (pango_ft2_render): fixed rendering of
+ monochrome bitmaps.
+
2003-04-02 Sven Neumann <sven@gimp.org>
* pango/pangoft2.c (pango_ft2_render_layout)
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 69cd0c2f..4de4069c 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,12 @@
+2003-04-03 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_font_get_face)
+ (pango_ft2_font_render_glyph): disable antialiasing if requested.
+ Fixes bug #109370.
+
+ * pango/pangoft2.c (pango_ft2_render): fixed rendering of
+ monochrome bitmaps.
+
2003-04-02 Sven Neumann <sven@gimp.org>
* pango/pangoft2.c (pango_ft2_render_layout)
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 69cd0c2f..4de4069c 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,12 @@
+2003-04-03 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_font_get_face)
+ (pango_ft2_font_render_glyph): disable antialiasing if requested.
+ Fixes bug #109370.
+
+ * pango/pangoft2.c (pango_ft2_render): fixed rendering of
+ monochrome bitmaps.
+
2003-04-02 Sven Neumann <sven@gimp.org>
* pango/pangoft2.c (pango_ft2_render_layout)
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index c283e1f8..d4ffdfa6 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -34,6 +34,11 @@
#include "pangoft2.h"
#include "pangoft2-private.h"
+/* for compatibility with older freetype versions */
+#ifndef FT_LOAD_TARGET_MONO
+#define FT_LOAD_TARGET_MONO FT_LOAD_MONOCHROME
+#endif
+
#define PANGO_TYPE_FT2_FONT (pango_ft2_font_get_type ())
#define PANGO_FT2_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FT2_FONT, PangoFT2Font))
#define PANGO_FT2_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FT2_FONT, PangoFT2FontClass))
@@ -196,33 +201,42 @@ load_fallback_face (PangoFT2Font *ft2font,
* Return value: a pointer to a #FT_Face structure, with the size set correctly
**/
FT_Face
-pango_ft2_font_get_face (PangoFont *font)
+pango_ft2_font_get_face (PangoFont *font)
{
PangoFT2Font *ft2font = (PangoFT2Font *)font;
FT_Error error;
FcPattern *pattern;
FcChar8 *filename;
- FcBool hinting, autohint;
+ FcBool antialias, hinting, autohint;
int id;
pattern = ft2font->font_pattern;
if (!ft2font->face)
{
- /* If we add support for not antialising, then we should
- * need to conditionalize NO_BITMAP on that.
- */
- ft2font->load_flags = FT_LOAD_NO_BITMAP;
+ ft2font->load_flags = 0;
+
+ /* disable antialiasing if requested */
+ if (FcPatternGetBool (pattern,
+ FC_ANTIALIAS, 0, &antialias) != FcResultMatch)
+ antialias = FcTrue;
+
+ if (antialias)
+ ft2font->load_flags |= FT_LOAD_NO_BITMAP;
+ else
+ ft2font->load_flags |= FT_LOAD_TARGET_MONO;
/* disable hinting if requested */
- if (FcPatternGetBool (pattern, FC_HINTING, 0, &hinting) != FcResultMatch)
+ if (FcPatternGetBool (pattern,
+ FC_HINTING, 0, &hinting) != FcResultMatch)
hinting = FcTrue;
if (!hinting)
ft2font->load_flags |= FT_LOAD_NO_HINTING;
/* force autohinting if requested */
- if (FcPatternGetBool (pattern, FC_AUTOHINT, 0, &autohint) != FcResultMatch)
+ if (FcPatternGetBool (pattern,
+ FC_AUTOHINT, 0, &autohint) != FcResultMatch)
autohint = FcFalse;
if (autohint)
@@ -246,7 +260,8 @@ pango_ft2_font_get_face (PangoFont *font)
if (!set_unicode_charmap (ft2font->face))
{
- g_warning ("Unable to load unicode charmap from font file %s", filename);
+ g_warning ("Unable to load unicode charmap from font file %s",
+ filename);
FT_Done_Face (ft2font->face);
ft2font->face = NULL;
@@ -342,11 +357,13 @@ pango_ft2_font_render_glyph (PangoFont *font,
if (face)
{
- PangoFT2Font *ft2font = (PangoFT2Font *)font;
-
+ PangoFT2Font *ft2font = (PangoFT2Font *) font;
+
/* Draw glyph */
FT_Load_Glyph (face, glyph_index, ft2font->load_flags);
- FT_Render_Glyph (face->glyph, ft_render_mode_normal);
+ FT_Render_Glyph (face->glyph,
+ (ft2font->load_flags & FT_LOAD_TARGET_MONO ?
+ ft_render_mode_mono : ft_render_mode_normal));
rendered->bitmap = face->glyph->bitmap;
rendered->bitmap.buffer = g_memdup (face->glyph->bitmap.buffer,
@@ -463,7 +480,7 @@ pango_ft2_render (FT_Bitmap *bitmap,
for (ix = x_start; ix < x_limit; ix++)
{
if ((*src) & (1 << (7 - (ix % 8))))
- *dest |= (1 << (7 - (ix % 8)));
+ *dest |= 0xff;
if ((ix % 8) == 7)
src++;
dest++;