freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] FT_Load_Glyph() - Always returns an error


From: SOULLARD Clement
Subject: Re: [Freetype] FT_Load_Glyph() - Always returns an error
Date: Fri, 13 Feb 2004 13:06:16 +0100
User-agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.6) Gecko/20040113

Hi,

After, doing the test function you were asking. I realize that I did an 
incorrect use of the APIs.
After I ask for a wrong glyph number (encoding instead of glyphnumber), 
I had the error code but the glyph slot was not reset to 0.
That is why I thought, the error code was wrong because the incorrect 
glyph bounding box was similar
to the glyph bounding box I expected.

Sorry for that...

SOULLARD Clement wrote:

>I  meet the same problem with this function but I'am using it under 
>linux using freetype 2.1.7.
>
>In some context it return the right error (Function 2), in an other it 
>return an error (Function 1)
>
>It occurs in a particular context (Function 1) when asking for a 
>bounding box (To check collision), in this context  I use the load glyph 
>only to position the glyphSlot (as the glyph is already loaded). Thought 
>the returned result indicate an error, it performs correctly the loading 
>(Or at least the positionning of the glyph Slot)
>
>I use then :
>- FT_Load_Glyph (face, nglyph, FT_LOAD_DEFAULT);
>
>But when rendering the bitmap in (Fonction 2) It work correctly.
>
>I use then : (There is no error raised)
>- FT_Load_Glyph (face, nglyph, FT_LOAD_RENDER)
>
>Hope this help, ask me if you want more informations....
>
>The concerned functions are :
>
>/*********************
>         Function 1
>*********************/
>QCoordsRect FTFont::getBoundingBox (int nglyph)
>{
>  glyphSlot = face->glyph;
>  //Chargement de la fonte
>  int
>    error =
>    0;
>    error=FT_Load_Glyph (face, nglyph, FT_LOAD_DEFAULT);
>  if (error)
>    {
>  Tracer::printErr("FTFont::getBoundingBox Erreur dans le chargement du 
>glyph");
>    }
> //  Tracer::printInfo("Passage par la fonction getBoundingBox de FTFont: "+
>  // QString::number(  glyphSlot->metrics.width / 64)+","+
> //  QString::number( glyphSlot->metrics.height / 64));
>
>  return QCoordsRect (-glyphSlot->metrics.horiBearingX* SCALEFACTOR / 
>resX  ,
>    - glyphSlot->metrics.horiBearingY*SCALEFACTOR/ resY ,
>    (-glyphSlot->metrics.horiBearingX)* SCALEFACTOR / resX +  
>glyphSlot->metrics.width*SCALEFACTOR / resX ,
>     - glyphSlot->metrics.horiBearingY*SCALEFACTOR/ resY+   
>glyphSlot->metrics.height* SCALEFACTOR / resY);
>}
>///////////////END FUNCTION///////////////////////////
>
>/*************
>Second function
>***************/
>
>FT_Bitmap
>FTFont::renderBmp(int nglyph){
>FT_Bitmap bitmap;
>glyphSlot = face->glyph;
>  //Chargement de la fonte
>  Tracer::printInfo ("FTFont::RenderBmp numero de glyphe 
>"+QString::number(nglyph));
>  if (FT_Load_Glyph (face, nglyph, FT_LOAD_RENDER))
>    {
>
>        Tracer::printErr (  "FTFont::RenderBmp Le glyphe ne s'est pas 
>correctement chargé : numero de glyphe "+ QString::number(nglyph));
>    }
>    bitmap=face->glyph->bitmap;
>  if (bitmap.width)
>    {
>
>    Tracer::printErr (  "FTFont::RenderBmp Le glyphe  s'est correctement 
>chargé : numero de glyphe "+ QString::number(nglyph) +" taille 
>"+QString::number(nglyph) );
>    return     bitmap;
>    }
>
> else{Tracer::printErr (
>          "FTFont::renderBmp Le glyphe ne s'est pas correctement chargé 
>: numero de glyphe "+
>          QString::number(nglyph)+
>          ", Taille = "+
>          QString::number(face->glyph->bitmap.width)+
>          ", Hauteur = "+
>            QString::number(face->glyph->bitmap.rows)+
>          ", Pitch = "+
>            QString::number(face->glyph->bitmap.pitch)
>          );
>    return     bitmap;
>}
>///////////////END FUNCTION///////////////////////////
>
>Werner LEMBERG wrote:
>
>  
>
>>>I still met this problem, I am using version 2.1.7 under mips.
>>>   
>>>
>>>      
>>>
>>Unfortunately, I don't have access to this platform.
>>
>> 
>>
>>    
>>
>>>I buit the library with following commands.
>>> CC=mipsel-linux-gcc ./configure --host=mips --prefix=/opt
>>> make
>>> make install
>>>it builds successfully without too much warning.
>>>   
>>>
>>>      
>>>
>>Which warnings?  Please report them.
>>
>> 
>>
>>    
>>
>>>But when I use this libaray with the example1.c in the freetype
>>>tutorial 1 webpage. FT_Load_Glyph return -1 or not enough
>>>memory. sometimes it shows it need to allocate over 600MB memory. Of
>>>course it is not possible on my embedded board. Could anyone has a
>>>cule why it happens? Thanks.
>>>   
>>>
>>>      
>>>
>>Which font?  The only thing I can try is to run valgrind (on my PC),
>>checking memory leaks or invalid memory accesses.
>>
>>
>>   Werner
>>
>>_______________________________________________
>>Freetype mailing list
>>address@hidden
>>http://www.freetype.org/mailman/listinfo/freetype
>> 
>>
>>    
>>
>
>
>
>--------------------------------------------------
>Ce message ainsi que les éventuelles pièces jointes constituent une 
>correspondance privée et confidentielle à lattention exclusive du 
>destinataire désigné ci-dessus. Si vous nêtes pas le destinataire du présent 
>message ou une personne susceptible de pouvoir le lui délivrer, il vous est 
>signifié que toute divulgation, distribution ou copie de cette transmission 
>est strictement interdite. Si vous avez reçu ce message par erreur, nous vous 
>remercions den informer lexpéditeur par téléphone ou de lui retourner le 
>présent message, puis deffacer immédiatement ce message de votre système.
>This e-mail and any attachments is a confidential correspondence intended only 
>for use of the individual or entity named above. If you are not the intended 
>recipient or the agent responsible for delivering the message to the  intended 
>recipient, you are hereby notified that any disclosure, distribution or 
>copying of this communication is strictly prohibited. If you have received 
>this communication in error, please notify the sender by phone or by replying 
>this message, and then delete this message from your system.
>·ž·*^™¨¥Šx%ŠËE­ç­Ê—Ÿ­ç­Ê—¨®m¶ŸÿÃ­ç­Ê—¨®æj)fjåŠËb�ú?~·ž·*^
>



--------------------------------------------------
Ce message ainsi que les éventuelles pièces jointes constituent une 
correspondance privée et confidentielle à l’attention exclusive du destinataire 
désigné ci-dessus. Si vous n’êtes pas le destinataire du présent message ou une 
personne susceptible de pouvoir le lui délivrer, il vous est signifié que toute 
divulgation, distribution ou copie de cette transmission est strictement 
interdite. Si vous avez reçu ce message par erreur, nous vous remercions d’en 
informer l’expéditeur par téléphone ou de lui retourner le présent message, 
puis d’effacer immédiatement ce message de votre système.
This e-mail and any attachments is a confidential correspondence intended only 
for use of the individual or entity named above. If you are not the intended 
recipient or the agent responsible for delivering the message to the  intended 
recipient, you are hereby notified that any disclosure, distribution or copying 
of this communication is strictly prohibited. If you have received this 
communication in error, please notify the sender by phone or by replying this 
message, and then delete this message from your system.

reply via email to

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