Commits

tanoku  committed 20d5d3c

Cleanup/misc fixes.

  • Participants
  • Parent commits c46d5ce
  • Branches pgreloaded

Comments (0)

Files changed (7)

File src/freetype/ft_cache.c

 
     for (i = 0; i <= cache->size_mask; ++i)
     {
-        if (cache->depths[i] > MAX_BUCKET_DEPTH)
+        while (cache->depths[i] > MAX_BUCKET_DEPTH)
         {
             node = cache->nodes[i];
             prev = NULL;
 
     /*
      * Load the glyph into the glyph slot
-     * TODO: error handling
      */
     if (FT_Load_Glyph(face, glyph->glyph_index, (FT_Int)load_flags) != 0 ||
         FT_Get_Glyph(face->glyph, &(glyph->image)) != 0)

File src/freetype/ft_font.c

 
     if (!target_surf || target_surf == Py_None)
     {
-        /* TODO! */
         PyObject *r_surface = NULL;
 
         r_surface = PGFT_Render_NewSurface(ft, font, &render, text,
     }
     else
     {
-        PyErr_SetString(PyExc_ValueError, "The given target is not a valid SDL surface");
+        PyErr_SetString(PyExc_TypeError, 
+                "The given target is not a valid SDL surface");
         return NULL;
     }
 
     if (!font)
         return NULL;
 
-    /* TODO: Create a constructor for fonts with default sizes? */
     font->default_ptsize = -1;
     font->default_style = FT_STYLE_NORMAL;
 

File src/freetype/ft_metrics.c

     int character, const FontRenderMode *render, int bbmode,
     void *minx, void *maxx, void *miny, void *maxy, void *advance)
 {
-    FT_Error error;
-    FTC_ScalerRec scale;
-    FT_Glyph glyph;
+    FT_Error        error;
+    FTC_ScalerRec   scale;
+    FontGlyph *     glyph = NULL;
 
-    /*
-     * TODO:
-     * Load the glyph information from the cache
-     */
 
-    return -1;
+    glyph = PGFT_Cache_FindGlyph(ft, &PGFT_INTERNALS(font)->cache, 
+            (FT_UInt)character, render);
 
-#if 0
-    _PGFT_BuildScaler(font, &scale, font_size);
+    if (!glyph)
+        return -1;
 
-    error = _PGFT_LoadGlyph(ft, font, 0, &scale, character, &glyph, NULL);
-
-    if (error)
-    {
-        _PGFT_SetError(ft, "Failed to load glyph metrics", error);
-        return error;
-    }
-#endif
-
-    _PGFT_GetMetrics_INTERNAL(glyph, (FT_UInt)bbmode, minx, maxx, miny, maxy, advance);
+    _PGFT_GetMetrics_INTERNAL(glyph->image, (FT_UInt)bbmode, 
+            minx, maxx, miny, maxy, advance);
 
     if (bbmode == FT_BBOX_EXACT || bbmode == FT_BBOX_EXACT_GRIDFIT)
     {

File src/freetype/ft_mod.c

     error = PGFT_Init(&(FREETYPE_MOD_STATE (self)->freetype), cache_size);
     if (error != 0)
     {
-        /* TODO: More accurate error message */
         PyErr_SetString(PyExc_PyGameError, 
                 "Failed to initialize the FreeType2 library");
         return NULL;

File src/freetype/ft_render.c

     while (angle < 0) angle += 360;
     mode->rotation_angle = (FT_UInt16)angle;
 
-    /* TODO: handle error returns on function calls */
     return 0;
 }
 

File src/freetype/ft_wrap.c

 
     _PGFT_BuildScaler(font, &scale, face_size);
 
-    /*
-     * TODO: Check if face has already been sized?
-     */
-
     error = FTC_Manager_LookupSize(ft->cache_manager, 
         &scale, &_fts);
 
     if (ft == NULL)
         return;
 
-    /* TODO: Free caches */
-
     if (ft->cache_manager)
         FTC_Manager_Done(ft->cache_manager);
 

File src/freetype/ft_wrap.h

 {
     PGFT_Cache  cache;
     FontText    active_text;
-
-    /* TODO */
 } FontInternals;
 
 #define PGFT_INTERNALS(f) ((FontInternals *)(f->_internals))