Exemple #1
0
Font::Font (const String& name, const String& fontname, const String& resourceGroup) :
    d_name (name),
    d_fileName (fontname),
    d_resourceGroup (resourceGroup),
    d_ascender (0),
    d_descender (0),
    d_height (0),
    d_autoScale (false),
    d_horzScaling (1.0f),
    d_vertScaling (1.0f),
    d_nativeHorzRes (DefaultNativeHorzRes),
    d_nativeVertRes (DefaultNativeVertRes),
    d_maxCodepoint (0),
    d_glyphPageLoaded (0)
{
    addFontProperties ();
}
Exemple #2
0
Font::Font (const XMLAttributes& attributes) :
    d_name (attributes.getValueAsString (FontNameAttribute)),
    d_fileName (attributes.getValueAsString (FontFilenameAttribute)),
    d_resourceGroup (attributes.getValueAsString (FontResourceGroupAttribute)),
    d_ascender (0),
    d_descender (0),
    d_height (0),
    d_autoScale (attributes.getValueAsBool(FontAutoScaledAttribute, false)),
    d_nativeHorzRes (static_cast< float >( attributes.getValueAsInteger (FontNativeHorzResAttribute, int (DefaultNativeHorzRes)))),
    d_nativeVertRes (static_cast< float >( attributes.getValueAsInteger (FontNativeVertResAttribute, int (DefaultNativeVertRes)))),
    d_maxCodepoint (0),
    d_glyphPageLoaded (0)
{
    addFontProperties ();

    Size size = System::getSingleton ().getRenderer()->getSize ();
    d_horzScaling = size.d_width / d_nativeHorzRes;
    d_vertScaling = size.d_height / d_nativeVertRes;
}
//----------------------------------------------------------------------------//
Font::Font(const String& name, const String& type_name, const String& filename,
           const String& resource_group, const AutoScaledMode auto_scaled,
           const Sizef& native_res):
    d_name(name),
    d_type(type_name),
    d_filename(filename),
    d_resourceGroup(resource_group),
    d_ascender(0),
    d_descender(0),
    d_height(0),
    d_autoScaled(auto_scaled),
    d_nativeResolution(native_res),
    d_maxCodepoint(0),
    d_glyphPageLoaded(0)
{
    addFontProperties();

    const Sizef size(System::getSingleton().getRenderer()->getDisplaySize());
    Image::computeScalingFactors(d_autoScaled, size, d_nativeResolution,
                                 d_horzScaling, d_vertScaling);
}