当前位置: 首页>>代码示例>>C++>>正文


C++ FontStyle::IsFixedWidth方法代码示例

本文整理汇总了C++中FontStyle::IsFixedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ FontStyle::IsFixedWidth方法的具体用法?C++ FontStyle::IsFixedWidth怎么用?C++ FontStyle::IsFixedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FontStyle的用法示例。


在下文中一共展示了FontStyle::IsFixedWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SaveList

/*!
    \brief This saves all family names and styles to the file specified in
    ServerConfig.h as SERVER_FONT_LIST as a flattened BMessage.

    This operation is not done very often because the access to disk adds a significant 
    performance hit.

    The format for storage consists of two things: an array of strings with the name 'family'
    and a number of small string arrays which have the name of the font family. These are
    the style lists. 

    Additionally, any fonts which have bitmap strikes contained in them or any fonts which
    are fixed-width are named in the arrays 'tuned' and 'fixed'.
*/
void FontServer::SaveList(void)
{
    int32 famcount=0, stycount=0,i=0,j=0;
    FontFamily *fam;
    FontStyle *sty;
    BMessage fontmsg, familymsg('FONT');
    BString famname, styname, extraname;
    bool fixed,tuned;

    famcount=families->CountItems();
    for(i=0; i<famcount; i++)
    {
        fam=(FontFamily*)families->ItemAt(i);
        fixed=false;
        tuned=false;
        if(!fam)
            continue;

        famname=fam->Name();
                
        // Add the family to the message
        familymsg.AddString("name",famname);
        
        stycount=fam->CountStyles();
        for(j=0;j<stycount;j++)
        {
            styname.SetTo(fam->GetStyle(j));
            if(styname.CountChars()>0)
            {
                // Add to list
                familymsg.AddString("styles", styname);
                
                // Check to see if it has prerendered strikes (has "tuned" fonts)
                sty=fam->GetStyle(styname.String());
                if(!sty)
                    continue;
                
                if(sty->HasTuned() && sty->IsScalable())
                    tuned=true;

                // Check to see if it is fixed-width
                if(sty->IsFixedWidth())
                    fixed=true;
            }
        }
        if(tuned)
            familymsg.AddBool("tuned",true);
        if(fixed)
            familymsg.AddBool("fixed",true);
        
        fontmsg.AddMessage("family",&familymsg);
        familymsg.MakeEmpty();
    }

    BFile file(SERVER_FONT_LIST,B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
    if(file.InitCheck()==B_OK)
        fontmsg.Flatten(&file);
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:72,代码来源:FontServer.cpp

示例2:

uint32
FontFamily::Flags()
{
    if (fFlags == kInvalidFamilyFlags) {
        fFlags = 0;

        int32 count = fStyles.CountItems();
        for (int32 i = 0; i < count; i++) {
            FontStyle* style = fStyles.ItemAt(i);

            if (style->IsFixedWidth())
                fFlags |= B_IS_FIXED;
            if (style->IsFullAndHalfFixed())
                fFlags |= B_PRIVATE_FONT_IS_FULL_AND_HALF_FIXED;
            if (style->TunedCount() > 0)
                fFlags |= B_HAS_TUNED_FONT;
        }
    }

    return fFlags;
}
开发者ID:mmanley,项目名称:Antares,代码行数:21,代码来源:FontFamily.cpp

示例3: path

status_t
DesktopSettingsPrivate::_Load()
{
    // TODO: add support for old app_server_settings file as well

    BPath basePath;
    status_t status = _GetPath(basePath);
    if (status < B_OK)
        return status;

    // read workspaces settings

    BPath path(basePath);
    path.Append("workspaces");

    BFile file;
    status = file.SetTo(path.Path(), B_READ_ONLY);
    if (status == B_OK) {
        BMessage settings;
        status = settings.Unflatten(&file);
        if (status == B_OK) {
            int32 columns;
            int32 rows;
            if (settings.FindInt32("columns", &columns) == B_OK
                    && settings.FindInt32("rows", &rows) == B_OK) {
                _ValidateWorkspacesLayout(columns, rows);
                fWorkspacesColumns = columns;
                fWorkspacesRows = rows;
            }

            int32 i = 0;
            while (i < kMaxWorkspaces && settings.FindMessage("workspace",
                    i, &fWorkspaceMessages[i]) == B_OK) {
                i++;
            }
        }
    }

    // read font settings

    path = basePath;
    path.Append("fonts");

    status = file.SetTo(path.Path(), B_READ_ONLY);
    if (status == B_OK) {
        BMessage settings;
        status = settings.Unflatten(&file);
        if (status == B_OK && gFontManager->Lock()) {
            const char* family;
            const char* style;
            float size;

            if (settings.FindString("plain family", &family) == B_OK
                    && settings.FindString("plain style", &style) == B_OK
                    && settings.FindFloat("plain size", &size) == B_OK) {
                FontStyle* fontStyle = gFontManager->GetStyle(family, style);
                fPlainFont.SetStyle(fontStyle);
                fPlainFont.SetSize(size);
            }

            if (settings.FindString("bold family", &family) == B_OK
                    && settings.FindString("bold style", &style) == B_OK
                    && settings.FindFloat("bold size", &size) == B_OK) {
                FontStyle* fontStyle = gFontManager->GetStyle(family, style);
                fBoldFont.SetStyle(fontStyle);
                fBoldFont.SetSize(size);
            }

            if (settings.FindString("fixed family", &family) == B_OK
                    && settings.FindString("fixed style", &style) == B_OK
                    && settings.FindFloat("fixed size", &size) == B_OK) {
                FontStyle* fontStyle = gFontManager->GetStyle(family, style);
                if (fontStyle != NULL && fontStyle->IsFixedWidth())
                    fFixedFont.SetStyle(fontStyle);
                fFixedFont.SetSize(size);
            }

            int32 hinting;
            if (settings.FindInt32("hinting", &hinting) == B_OK)
                gDefaultHintingMode = hinting;

            gFontManager->Unlock();
        }
    }

    // read mouse settings

    path = basePath;
    path.Append("mouse");

    status = file.SetTo(path.Path(), B_READ_ONLY);
    if (status == B_OK) {
        BMessage settings;
        status = settings.Unflatten(&file);
        if (status == B_OK) {
            int32 mode;
            if (settings.FindInt32("mode", &mode) == B_OK)
                fMouseMode = (mode_mouse)mode;

            int32 focusFollowsMouseMode;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的FontStyle::IsFixedWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。