freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] Help: Cannot load glyphs


From: Menczel Laszlo
Subject: [ft] Help: Cannot load glyphs
Date: Thu, 01 Feb 2007 14:44:29 +0100

Hi,

I have a problem when using the FreeType library. I can initialize the
library and create a new face, but when I try to load a glyph it fails.
I used the following simple test program:

--------------------- code -----------------------

#include <stdio.h>
#include <ft2build.h>
#include FT_FREETYPE_H

static char *path = "/usr/X11R6/lib/fonts/TTF/luxisr.ttf";

static void dump_glyph_bmp(FT_GlyphSlot s)
{
  printf
  (
    "bitmap:\n  rows   = %d\n  width  = %d\n  pitch  = %d\n  buffer = %p\n",
    s->bitmap.rows, s->bitmap.width, s->bitmap.pitch, s->bitmap.buffer
  );
}

int main(int argc, char *argv[])
{
  FT_Library lib;
  FT_Face face;
  int i;

  if (FT_Init_FreeType(&lib) != 0)
  {
    printf("FT init error\n");
    return 1;
  }
  if (FT_New_Face(lib, path, 0, &face) != 0)
  {
    printf("Font loading error\n");
    return 1;
  }
  if (FT_Set_Pixel_Sizes(face, 10, 18) != 0)
  {
    printf("Size setting error\n");
    return 1;
  }
  i = FT_Get_Char_Index(face, 'X');
  if (i == 0)
  {
    printf("Error: glyph index = 0\n");
    return 1;
  }
  if (FT_Load_Glyph(face, i, FT_RENDER_MODE_NORMAL) != 0)
  {
    printf("Glyph loading error\n");
    return 1;
  }
  dump_glyph_bmp(face->glyph);
  return 0;
}

---------------------- code end ---------------------------

The output from this program is:

bitmap:
  rows   = 0
  width  = 0
  pitch  = 0
  buffer = (nil)

that is, all functions are executed w/o error, but the bitmap in the
glyph slot is empty.

My setup is the following:

system: Zenwalk Linux 2.6 (Slackware based)
kernel: 2.6.16.16
freetype library: 6.3.7
gcc: 3.4.6

I have found no clue in the available documentation. I would appreciate
getting some advice on how to make it work.

Thanks!

Laszlo Menczel
Szeged, Hungary

._____________________________________________________________________Új év, új 
karrier? A jobMonitor Állásfutár hírlevele segít megtalálni a tökéletes 
állást!Keress nálunk, keresés nélkül! http://www.jobmonitor.hu/hirlevel.php



reply via email to

[Prev in Thread] Current Thread [Next in Thread]