Divide size by 2, not multiply.

2000-12-04  Alexander Larsson  <alexl@redhat.com>

	* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
	multiply.

	* gdk/linux-fb/gdkpango-fb.c:
	Copied some 26.6 scaling macros from pango to clean up the rounding.
	(pango_fb_font_get_glyph_info): Correct sign on x value.

	* gdk/linux-fb/gdkprivate-fb.h:
	Removed unreferenced external functions.

	* modules/linux-fb/Makefile.am: Use ` instead of '.

	* modules/linux-fb/basic.c:
	Remove dead code. In particular the dummy lang engine which broke all
	pango layouts in GtkFB. Don't include tables-big.i anymore.

	* modules/linux-fb/tables-big.i:
	Upgrade to latest version from pango. Left for reference, basic_ranges
	moved to basic.c.
This commit is contained in:
Alexander Larsson 2000-12-04 17:59:43 +00:00 committed by Alexander Larsson
parent 9cca191b6a
commit d77144614b
13 changed files with 2683 additions and 2626 deletions

View File

@ -1,3 +1,25 @@
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
multiply.
* gdk/linux-fb/gdkpango-fb.c:
Copied some 26.6 scaling macros from pango to clean up the rounding.
(pango_fb_font_get_glyph_info): Correct sign on x value.
* gdk/linux-fb/gdkprivate-fb.h:
Removed unreferenced external functions.
* modules/linux-fb/Makefile.am: Use ` instead of '.
* modules/linux-fb/basic.c:
Remove dead code. In particular the dummy lang engine which broke all
pango layouts in GtkFB. Don't include tables-big.i anymore.
* modules/linux-fb/tables-big.i:
Upgrade to latest version from pango. Left for reference, basic_ranges
moved to basic.c.
2000-12-04 Havoc Pennington <hp@redhat.com>
Fix bugs Alex found:

View File

@ -1,3 +1,25 @@
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
multiply.
* gdk/linux-fb/gdkpango-fb.c:
Copied some 26.6 scaling macros from pango to clean up the rounding.
(pango_fb_font_get_glyph_info): Correct sign on x value.
* gdk/linux-fb/gdkprivate-fb.h:
Removed unreferenced external functions.
* modules/linux-fb/Makefile.am: Use ` instead of '.
* modules/linux-fb/basic.c:
Remove dead code. In particular the dummy lang engine which broke all
pango layouts in GtkFB. Don't include tables-big.i anymore.
* modules/linux-fb/tables-big.i:
Upgrade to latest version from pango. Left for reference, basic_ranges
moved to basic.c.
2000-12-04 Havoc Pennington <hp@redhat.com>
Fix bugs Alex found:

View File

@ -1,3 +1,25 @@
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
multiply.
* gdk/linux-fb/gdkpango-fb.c:
Copied some 26.6 scaling macros from pango to clean up the rounding.
(pango_fb_font_get_glyph_info): Correct sign on x value.
* gdk/linux-fb/gdkprivate-fb.h:
Removed unreferenced external functions.
* modules/linux-fb/Makefile.am: Use ` instead of '.
* modules/linux-fb/basic.c:
Remove dead code. In particular the dummy lang engine which broke all
pango layouts in GtkFB. Don't include tables-big.i anymore.
* modules/linux-fb/tables-big.i:
Upgrade to latest version from pango. Left for reference, basic_ranges
moved to basic.c.
2000-12-04 Havoc Pennington <hp@redhat.com>
Fix bugs Alex found:

View File

@ -1,3 +1,25 @@
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
multiply.
* gdk/linux-fb/gdkpango-fb.c:
Copied some 26.6 scaling macros from pango to clean up the rounding.
(pango_fb_font_get_glyph_info): Correct sign on x value.
* gdk/linux-fb/gdkprivate-fb.h:
Removed unreferenced external functions.
* modules/linux-fb/Makefile.am: Use ` instead of '.
* modules/linux-fb/basic.c:
Remove dead code. In particular the dummy lang engine which broke all
pango layouts in GtkFB. Don't include tables-big.i anymore.
* modules/linux-fb/tables-big.i:
Upgrade to latest version from pango. Left for reference, basic_ranges
moved to basic.c.
2000-12-04 Havoc Pennington <hp@redhat.com>
Fix bugs Alex found:

View File

@ -1,3 +1,25 @@
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
multiply.
* gdk/linux-fb/gdkpango-fb.c:
Copied some 26.6 scaling macros from pango to clean up the rounding.
(pango_fb_font_get_glyph_info): Correct sign on x value.
* gdk/linux-fb/gdkprivate-fb.h:
Removed unreferenced external functions.
* modules/linux-fb/Makefile.am: Use ` instead of '.
* modules/linux-fb/basic.c:
Remove dead code. In particular the dummy lang engine which broke all
pango layouts in GtkFB. Don't include tables-big.i anymore.
* modules/linux-fb/tables-big.i:
Upgrade to latest version from pango. Left for reference, basic_ranges
moved to basic.c.
2000-12-04 Havoc Pennington <hp@redhat.com>
Fix bugs Alex found:

View File

@ -1,3 +1,25 @@
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
multiply.
* gdk/linux-fb/gdkpango-fb.c:
Copied some 26.6 scaling macros from pango to clean up the rounding.
(pango_fb_font_get_glyph_info): Correct sign on x value.
* gdk/linux-fb/gdkprivate-fb.h:
Removed unreferenced external functions.
* modules/linux-fb/Makefile.am: Use ` instead of '.
* modules/linux-fb/basic.c:
Remove dead code. In particular the dummy lang engine which broke all
pango layouts in GtkFB. Don't include tables-big.i anymore.
* modules/linux-fb/tables-big.i:
Upgrade to latest version from pango. Left for reference, basic_ranges
moved to basic.c.
2000-12-04 Havoc Pennington <hp@redhat.com>
Fix bugs Alex found:

View File

@ -1,3 +1,25 @@
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not
multiply.
* gdk/linux-fb/gdkpango-fb.c:
Copied some 26.6 scaling macros from pango to clean up the rounding.
(pango_fb_font_get_glyph_info): Correct sign on x value.
* gdk/linux-fb/gdkprivate-fb.h:
Removed unreferenced external functions.
* modules/linux-fb/Makefile.am: Use ` instead of '.
* modules/linux-fb/basic.c:
Remove dead code. In particular the dummy lang engine which broke all
pango layouts in GtkFB. Don't include tables-big.i anymore.
* modules/linux-fb/tables-big.i:
Upgrade to latest version from pango. Left for reference, basic_ranges
moved to basic.c.
2000-12-04 Havoc Pennington <hp@redhat.com>
Fix bugs Alex found:

View File

@ -299,8 +299,8 @@ gdk_text_width (GdkFont *font,
GdkFontPrivateFB *private;
private = (GdkFontPrivateFB*) font;
return text_length * private->size / (PANGO_SCALE/2);
return text_length * private->size / (2*PANGO_SCALE);
#endif
}

View File

@ -17,6 +17,13 @@
#define PANGO_RENDER_TYPE_FB "PangoRenderTypeFB"
#define PANGO_SCALE_26_6 (PANGO_SCALE / (1<<6))
#define PANGO_PIXELS_26_6(d) \
(((d) >= 0) ? \
((d) + PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6 : \
((d) - PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6)
#define PANGO_UNITS_26_6(d) (PANGO_SCALE_26_6 * (d))
typedef struct {
PangoFontMap parent_instance;
@ -668,20 +675,16 @@ pango_fb_font_get_glyph_info (PangoFont *font, PangoGlyph glyph)
my_ink_rect = &pgi->extents[0];
my_logical_rect = &pgi->extents[1];
{
my_ink_rect->width = (PANGO_SCALE * g->metrics.width + 32) >> 6;
my_ink_rect->height = (PANGO_SCALE * g->metrics.height + 32) >> 6;
my_ink_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX + 32) >> 6);
my_ink_rect->y = - ((PANGO_SCALE * g->metrics.horiBearingY + 32) >> 6);
}
{
my_logical_rect->width = (PANGO_SCALE * g->metrics.horiAdvance + 32) >> 6;
my_logical_rect->height = (PANGO_SCALE * ftf->size->metrics.height + 32) >> 6;
my_logical_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX + 32) >> 6);
my_logical_rect->y = - ((PANGO_SCALE * ftf->size->metrics.ascender + 32) >> 6);
}
my_ink_rect->x = PANGO_UNITS_26_6 (g->metrics.horiBearingX);
my_ink_rect->width = PANGO_UNITS_26_6 (g->metrics.width);
my_ink_rect->y = -PANGO_UNITS_26_6 (g->metrics.horiBearingY);
my_ink_rect->height = PANGO_UNITS_26_6 (g->metrics.height);
my_logical_rect->x = 0;
my_logical_rect->width = PANGO_UNITS_26_6 (g->metrics.horiAdvance);
my_logical_rect->y = -PANGO_UNITS_26_6 (ftf->size->metrics.ascender + 64);
my_logical_rect->height = PANGO_UNITS_26_6 (ftf->size->metrics.height + 128);
g_hash_table_insert (fbf->glyph_info, GUINT_TO_POINTER(glyph), pgi);
return pgi;
@ -795,11 +798,13 @@ void
pango_fb_font_set_size (PangoFont *font)
{
PangoFBFont *fbf = (PangoFBFont *)font;
gint height;
if (PANGO_FB_FONT (font)->desc.size != GPOINTER_TO_UINT (fbf->ftf->generic.data))
{
fbf->ftf->generic.data = GUINT_TO_POINTER (PANGO_FB_FONT (font)->desc.size);
FT_Set_Char_Size (fbf->ftf, 0, PANGO_PIXELS (PANGO_FB_FONT (font)->desc.size << 6), 72, 72);
height = PANGO_FB_FONT (font)->desc.size;
fbf->ftf->generic.data = GUINT_TO_POINTER (height);
FT_Set_Char_Size (fbf->ftf, 0, PANGO_PIXELS_26_6 (height), 72, 72);
}
}
@ -815,8 +820,6 @@ pango_fb_font_get_glyph_extents (PangoFont *font,
fbf = PANGO_FB_FONT (font);
pango_fb_font_set_size (font);
gi = pango_fb_font_get_glyph_info (font, glyph);
my_extents = gi->extents;
@ -840,8 +843,8 @@ pango_fb_font_get_metrics (PangoFont *font,
if (metrics)
{
metrics->ascent = (ftf->size->metrics.ascender * PANGO_SCALE + 32) >> 6;
metrics->descent = ((-ftf->size->metrics.descender) * PANGO_SCALE + 32) >> 6;
metrics->ascent = PANGO_UNITS_26_6 (ftf->size->metrics.ascender);
metrics->descent = PANGO_UNITS_26_6 (-ftf->size->metrics.descender);
}
}

View File

@ -392,7 +392,9 @@ void gdk_fb_window_send_crossing_events (GdkWindow *dest,
#define PANGO_TYPE_FB_FONT (pango_fb_font_get_type ())
#define PANGO_FB_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FB_FONT, PangoFBFont))
typedef struct _PangoFBFont PangoFBFont;
struct _PangoFBFont
{
PangoFont parent;
@ -402,16 +404,16 @@ struct _PangoFBFont
PangoCoverage *coverage;
GHashTable *glyph_info;
};
typedef struct {
PangoRectangle extents[2];
GdkPixmapFBData fbd;
int top, left;
} PangoFBGlyphInfo;
GType pango_fb_font_get_type (void) G_GNUC_CONST;
gboolean pango_fb_has_glyph(PangoFont *font, PangoGlyph glyph);
PangoGlyph pango_fb_get_unknown_glyph(PangoFont *font);
PangoFBGlyphInfo *pango_fb_font_get_glyph_info(PangoFont *font, PangoGlyph glyph);
GType pango_fb_font_get_type (void) G_GNUC_CONST;
PangoFBGlyphInfo *pango_fb_font_get_glyph_info (PangoFont *font,
PangoGlyph glyph);
void gdk_fb_window_move_resize (GdkWindow *window,
gint x,

View File

@ -6,7 +6,7 @@ INCLUDES = @STRIP_BEGIN@ \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
-I$(top_srcdir)/gdk/linux-fb \
`freetype-config --cflags'\
`freetype-config --cflags`\
@GTK_DEBUG_FLAGS@ \
@GTK_XIM_FLAGS@ \
@GTK_LOCALE_FLAGS@ \

View File

@ -26,73 +26,30 @@
#include "gdkprivate-fb.h"
#include <string.h>
PangoGlyph
pango_fb_get_unknown_glyph(PangoFont *font)
{
return FT_Get_Char_Index (PANGO_FB_FONT (font)->ftf, '~');
}
typedef struct _CharRange CharRange;
typedef struct _Charset Charset;
typedef struct _CharCache CharCache;
typedef struct _MaskTable MaskTable;
#define MAX_CHARSETS 32
typedef PangoGlyph (*ConvFunc) (CharCache *cache,
Charset *charset,
const gchar *input);
struct _CharRange
{
guint16 start;
guint16 end;
guint16 charsets;
};
struct _MaskTable
{
int n_subfonts;
Charset **charsets;
};
#define MAX_CHARSETS 32
struct _CharCache
{
#if 0
MaskTable *mask_tables[256];
#endif
GIConv converters[MAX_CHARSETS];
};
struct _Charset
{
int index;
char *id;
char *x_charset;
ConvFunc conv_func;
static PangoEngineRange basic_ranges[] = {
/* Language characters */
{ 0x0000, 0x02af, "*" },
{ 0x02b0, 0x02ff, "" },
{ 0x0380, 0x058f, "*" },
{ 0x0591, 0x05f4, "*" }, /* Hebrew */
{ 0x060c, 0x06f9, "" }, /* Arabic */
{ 0x0e01, 0x0e5b, "" }, /* Thai */
{ 0x10a0, 0x10ff, "*" }, /* Georgian */
{ 0x1200, 0x16ff, "*" }, /* Ethiopic,Cherokee,Canadian,Ogham,Runic */
{ 0x1e00, 0x1fff, "*" },
{ 0x2000, 0x9fff, "*" },
{ 0xac00, 0xd7a3, "kr" },
{ 0xf900, 0xfa0b, "kr" },
{ 0xff00, 0xffe3, "*" }
};
static PangoGlyph conv_8bit (CharCache *cache,
Charset *charset,
const char *input);
static PangoGlyph conv_euc (CharCache *cache,
Charset *charset,
const char *input);
static PangoGlyph conv_ucs4 (CharCache *cache,
Charset *charset,
const char *input);
#include "tables-big.i"
static PangoEngineInfo script_engines[] = {
{
"BasicScriptEngineLang",
PANGO_ENGINE_TYPE_LANG,
PANGO_RENDER_TYPE_NONE,
basic_ranges, G_N_ELEMENTS(basic_ranges)
},
{
"BasicScriptEngineFB",
PANGO_ENGINE_TYPE_SHAPE,
@ -103,33 +60,6 @@ static PangoEngineInfo script_engines[] = {
static gint n_script_engines = G_N_ELEMENTS (script_engines);
/*
* Language script engine
*/
static void
basic_engine_break (const char *text,
gint len,
PangoAnalysis *analysis,
PangoLogAttr *attrs)
{
}
static PangoEngine *
basic_engine_lang_new ()
{
PangoEngineLang *result;
result = g_new (PangoEngineLang, 1);
result->engine.id = "BasicScriptEngine";
result->engine.type = PANGO_ENGINE_TYPE_LANG;
result->engine.length = sizeof (result);
result->script_break = basic_engine_break;
return (PangoEngine *)result;
}
/*
* FB window system script engine portion
*/
@ -138,36 +68,15 @@ static CharCache *
char_cache_new (void)
{
CharCache *result;
int i;
result = g_new0 (CharCache, 1);
for (i=0; i < MAX_CHARSETS; i++)
result->converters[i] = (GIConv)-1;
return result;
}
static void
char_cache_free (CharCache *cache)
{
int i;
#if 0
for (i=0; i < 256; i++)
if (cache->mask_tables[i])
{
g_free (cache->mask_tables[i]->subfonts);
g_free (cache->mask_tables[i]->charsets);
g_free (cache->mask_tables[i]);
}
#endif
for (i=0; i<MAX_CHARSETS; i++)
if (cache->converters[i] != (GIConv)-1)
g_iconv_close (cache->converters[i]);
g_free (cache);
}
@ -193,74 +102,6 @@ set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGl
glyphs->glyphs[i].geometry.width = logical_rect.width;
}
static GIConv
find_converter (CharCache *cache, Charset *charset)
{
GIConv cd = cache->converters[charset->index];
if (cd == (GIConv)-1)
{
cd = g_iconv_open (charset->id, "UTF-8");
g_assert (cd != (GIConv)-1);
cache->converters[charset->index] = cd;
}
return cd;
}
static PangoGlyph
conv_8bit (CharCache *cache,
Charset *charset,
const char *input)
{
GIConv cd;
char outbuf;
const char *inptr = input;
size_t inbytesleft;
char *outptr = &outbuf;
size_t outbytesleft = 1;
inbytesleft = g_utf8_next_char(input) - input;
cd = find_converter (cache, charset);
g_iconv (cd, (gchar **)&inptr, &inbytesleft, &outptr, &outbytesleft);
return (guchar)outbuf;
}
static PangoGlyph
conv_euc (CharCache *cache,
Charset *charset,
const char *input)
{
GIConv cd;
char outbuf[2];
const char *inptr = input;
size_t inbytesleft;
char *outptr = outbuf;
size_t outbytesleft = 2;
inbytesleft = g_utf8_next_char(input) - input;
cd = find_converter (cache, charset);
g_iconv (cd, (gchar **)&inptr, &inbytesleft, &outptr, &outbytesleft);
if ((guchar)outbuf[0] < 128)
return outbuf[0];
else
return ((guchar)outbuf[0] & 0x7f) * 256 + ((guchar)outbuf[1] & 0x7f);
}
static PangoGlyph
conv_ucs4 (CharCache *cache,
Charset *charset,
const char *input)
{
return g_utf8_get_char (input);
}
static void
swap_range (PangoGlyphString *glyphs, int start, int end)
@ -282,6 +123,12 @@ swap_range (PangoGlyphString *glyphs, int start, int end)
}
}
static PangoGlyph
pango_fb_get_unknown_glyph(PangoFont *font)
{
return FT_Get_Char_Index (PANGO_FB_FONT (font)->ftf, '~');
}
static CharCache *
get_char_cache (PangoFont *font)
{
@ -330,7 +177,7 @@ basic_engine_shape (PangoFont *font,
char buf[6];
const char *input;
wc = g_utf8_get_char(p);
wc = g_utf8_get_char (p);
input = p;
if (analysis->level % 2)
@ -377,7 +224,7 @@ basic_engine_shape (PangoFont *font,
set_glyph (font, glyphs, i, p - text, pango_fb_get_unknown_glyph (font));
}
p = g_utf8_next_char(p);
p = g_utf8_next_char (p);
}
/* Simple bidi support... may have separate modules later */
@ -460,8 +307,6 @@ MODULE_ENTRY(script_engine_load) (const char *id)
{
if (!strcmp (id, "BasicScriptEngineFB"))
return basic_engine_fb_new ();
else if (!strcmp (id, "BasicScriptEngineLang"))
return basic_engine_lang_new ();
else
return NULL;
}

File diff suppressed because it is too large Load Diff