Workaround for bug 2239, minor tweaks for "attached" font files.

This commit is contained in:
Raph Levien 2000-09-07 07:12:02 +00:00
parent 3db3030fa9
commit 85fa78dae2
5 changed files with 29 additions and 4 deletions

View file

@ -1,3 +1,15 @@
2000-09-06 Raph Levien <raph@acm.org>
* librsvg/test-ft-gtk.c: Added "-a" option for attaching AFM
files, used to confirm that bugzilla.eazel.com 2141 affects
TrueType and not Type1 fonts. Also added const to filename
argument.
* librsvg/rsvg.c (rsvg_start_svg): Patch for bugzilla.eazel.com
2239. If width and height are not specified in the SVG file,
defaults are used. Previously, the creation of the pixbuf was
failing, causing downstream code to segfault on the NULL.
2000-09-07 Andy Hertzfeld <andy@eazel.com>
* libnautilus-extensions/nautilus-background.c:

View file

@ -377,6 +377,8 @@ rsvg_ft_intern (RsvgFTCtx *ctx, const char *font_file_name)
if (entry != NULL) {
/* found in font list */
/* todo: I think moving the font to the front of the
lru list should happen on resolve, not intern */
/* move entry to front of LRU list */
if (entry->prev != NULL) {
entry->prev->next = entry->next;
@ -433,7 +435,7 @@ rsvg_ft_intern (RsvgFTCtx *ctx, const char *font_file_name)
**/
void
rsvg_ft_font_attach (RsvgFTCtx *ctx, RsvgFTFontHandle fh,
char *font_file_name)
const char *font_file_name)
{
RsvgFTFontCacheEntry *entry;
RsvgFTFont *font;

View file

@ -22,7 +22,7 @@ rsvg_ft_intern (RsvgFTCtx *ctx, const char *font_file_name);
void
rsvg_ft_font_attach (RsvgFTCtx *ctx, RsvgFTFontHandle fh,
char *font_file_name);
const char *font_file_name);
#if 0
void

View file

@ -230,6 +230,13 @@ rsvg_start_svg (RsvgCtx *ctx, const xmlChar **atts)
width, height);
#endif
if (width < 0 || height < 0)
{
g_warning ("rsvg_start_svg: width and height attributes are not present in SVG\n");
if (width < 0) width = 500;
if (height < 0) height = 500;
}
/* Scale size of target pixbuf */
width = ceil (width * ctx->zoom);
height = ceil (height * ctx->zoom);

View file

@ -307,7 +307,8 @@ test_ft_quit (GtkWidget *widget, TestCtx *ctx)
gtk_main_quit ();
}
static TestCtx *new_test_window (const char *fn, int width, int height)
static TestCtx *new_test_window (const char *fn, const char *afn,
int width, int height)
{
GtkWidget *topwin;
GtkWidget *vbox;
@ -331,6 +332,7 @@ static TestCtx *new_test_window (const char *fn, int width, int height)
ctx->ctx = rsvg_ft_ctx_new ();
ctx->fh = rsvg_ft_intern (ctx->ctx, fn);
if (afn) rsvg_ft_font_attach (ctx->ctx, ctx->fh, afn);
ctx->n_lines = 0;
ctx->lines = NULL;
ctx->y_sp = 16;
@ -415,6 +417,7 @@ int main(int argc, char **argv)
gint font_width = 36;
gint font_height = 36;
char *font_file_name = "/usr/share/fonts/default/Type1/n021003l.pfb";
char *add_font_file_name = NULL;
char *text_file_name = "rsvg-ft.c";
poptContext optCtx;
@ -424,6 +427,7 @@ int main(int argc, char **argv)
{"font-width", 'w', POPT_ARG_INT, &font_width, 0, NULL, "Font Width"},
{"font-height", 'h', POPT_ARG_INT, &font_height, 0, NULL, "Font Height"},
{"font-file-name", 'f', POPT_ARG_STRING, &font_file_name, 0, NULL, "Font File Name"},
{"add-font-file-name", 'a', POPT_ARG_STRING, &add_font_file_name, 0, NULL, "Additional Font File Name"},
{"text-file-name", 't', POPT_ARG_STRING, &text_file_name, 0, NULL, "Text"},
POPT_AUTOHELP {NULL, 0, 0, NULL, 0}
};
@ -445,7 +449,7 @@ int main(int argc, char **argv)
c = poptGetNextOpt(optCtx);
args = poptGetArgs(optCtx);
ctx = new_test_window (font_file_name, 640, 480);
ctx = new_test_window (font_file_name, add_font_file_name, 640, 480);
set_text (ctx, text_file_name);