Changeset 6

Show
Ignore:
Timestamp:
01/01/07 06:16:56 (4 days ago)
Author:
ping
Message:

* fix the return values of some functions.
* add a README and a font file wenquanyi_12pt.pcf.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • people/ping/pcfdump/libfont.c

    r5 r6  
    6060    register unsigned char     * pglyph; 
    6161    register char     * p, * pImage; 
     62    int                 ret; 
    6263 
    6364    if (handle >= last_font || handle < 0) {    /* out of boundary */ 
     
    6970 
    7071    /* get the glyph from the font */ 
    71     __get_glyph(used_fonts[handle], ch, &nglyphs, &pci); 
     72    ret = __get_glyph(used_fonts[handle], ch, &nglyphs, &pci); 
     73    if (ret != 0) {   return ret; } 
    7274 
    7375    /* convert to the padded format */ 
    7476    mtc = &(pci->metrics); 
     77    /* 
    7578    printf("metric:  left = %d, right = %d, characterWidth = %d, ascent = %d, descent = %d\n",  
    7679        mtc->leftSideBearing, mtc->rightSideBearing, mtc->characterWidth, 
    77         mtc->ascent, mtc->descent); 
     80        mtc->ascent, mtc->descent); */ 
    7881 
    7982    glyph->left = mtc->leftSideBearing; 
     
    192195 
    193196 
    194 __get_glyph(FontPtr pFont, unsigned char * chs, unsigned long * pnglyphs, 
     197int __get_glyph(FontPtr pFont, unsigned char * chs, unsigned long * pnglyphs, 
    195198    CharInfoPtr * ppci) 
    196199{ 
     
    213216    /* printf("  encoding = %d\n", encoding); */ 
    214217    (*pFont->get_glyphs) (pFont, 1, chs, encoding, pnglyphs, ppci); 
    215     printf("nglyphs = %d, pci = %x\n", *pnglyphs, *ppci); 
    216  
     218    /* printf("nglyphs = %d, pci = %x\n", *pnglyphs, *ppci); */ 
     219    if (*pnglyphs == 0) { 
     220        return -1; 
     221    } 
     222    return 0; 
    217223} 
    218224 
  • people/ping/pcfdump/pcfdump.c

    r5 r6  
    5555    } 
    5656    ret = font_get_glyph(handle, chs, &glyph); 
     57    /* printf("ret = %d\n", ret); */ 
     58    if (ret != 0) { 
     59        fprintf(stderr, "failed to get glyph from font\n"); 
     60        exit(2); 
     61    } 
    5762    font_show_glyph(&glyph); 
    5863    font_close(handle);