MoText font family and style problem



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/01/2012 at 11:28, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R13 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi,

    I've a small problem with the MoText object.

    If I try to retrieve font family and style names from a MoText object (in a EffectorData plugin), this fails until the user selects at least once a font. Beforehand one seems to have to fall back to the default font.

    This code which works for me (called in InitPoints()), feels a bit ugly:

      
    GeData d;  
    FontData *fd;  
    BaseContainer bcFont;  
      
    if (!bcDataGenerator->GetParameter(DescLevel(PRIM_TEXT_FONT), d)) {  
    // error handling  
    }  
    fd = (FontData* )d.GetCustomDataType(FONTCHOOSER_DATA);  
    if (!fd) {  
    // error handling  
    }  
    bcFont = fd->GetFont();  
    if ( (!GeClipMap::GetFontName(&bcFont, GE_FONT_NAME_FAMILY, &sNameFamilyC4D)) &&  
    ( (!GeClipMap::GetDefaultFont(GE_FONT_DEFAULT_SYSTEM, &bcFont)) ||  
    (!GeClipMap::GetFontName(&bcFont, GE_FONT_NAME_FAMILY, &sNameFamilyC4D)) ) ) {  
    // Now here we have always info on font family and style  
    // also if the MoText just go freshly created  
    }  
    

    So this works, but I'd like to get rid of the GetDefaultFont() stuff.

    Best regards,
    Andreas


Log in to reply