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


C++ Graphics::setFont方法代码示例

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


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

示例1: paint

//==============================================================================
void LufsPluginEditor::paint (juce::Graphics& g)
{
    DEBUGPLUGIN_output("LufsPluginEditor::paint");

    g.fillAll( LUFS_COLOR_BACKGROUND );

    juce::Font lufsFont( 36.f );
    lufsFont.setBold(true);
    g.setFont( lufsFont );
    g.setColour( LUFS_COLOR_FONT );

    int x = 10;
    const int width = 120;
    const int height = 60;
    g.setColour( COLOR_LUFSTIME );
    g.drawFittedText( juce::String( "LUFS" ), x, 10, width, 40, juce::Justification::centred, 1, 0.01f );
    x += width;

    juce::Font font( 18.f );
    font.setBold(true);
    g.setFont( font );

    g.setColour( COLOR_MOMENTARY );
    g.drawFittedText( juce::String( "Momentary" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
    x += width;
    g.setColour( COLOR_SHORTTERM );
    g.drawFittedText( juce::String( "Short term" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
    x += width;
    g.setColour( COLOR_INTEGRATED );
    g.drawFittedText( juce::String( "Integrated" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
    x += width;
    g.setColour( COLOR_RANGE );
    g.drawFittedText( juce::String( "Range" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
}
开发者ID:mpavageau,项目名称:MeasuringLUFS,代码行数:35,代码来源:LufsPluginEditor.cpp

示例2: paintListBoxItem

void InterfaceComponent::paintListBoxItem (const int rowNumber,
                                           juce::Graphics& g,
                                           const int width, const int height,
                                           const bool isRowSelected)
{
    if (isRowSelected)
    {
        g.fillAll (juce::Colours::white.darker());
        g.setColour (juce::Colours::white.darker().contrasting());
    }
    else
    {
        g.setColour (fileListBox.findColour (juce::ListBox::textColourId));
    }

    g.setFont (height * 0.7f);

    g.drawText (files[rowNumber],
                5, 0, width, height,
                juce::Justification::centredLeft, false);

    const float h = (float) height;
    const float w = (float) width;
    const float offset = 5.0f;
    const float thickness = 0.25f;

    g.setColour (juce::Colours::lightgrey);

    g.drawLine (offset, h - thickness,
                w - (offset * 2.0f), h - thickness,
                thickness);
}
开发者ID:jrlanglois,项目名称:FileModularizer,代码行数:32,代码来源:InterfaceComponent.cpp

示例3: drawLabel

void NTLookAndFeel::drawLabel(juce::Graphics &g, juce::Label &label){
    g.fillAll (label.findColour (Label::backgroundColourId));
    
    if (! label.isBeingEdited())
    {
        const float alpha = label.isEnabled() ? 1.0f : 0.5f;
        const Font font (getLabelFont (label));
        
        g.setColour (label.findColour (Label::textColourId).withMultipliedAlpha (alpha));
        g.setFont (font);
        
        Rectangle<int> textArea (label.getBorderSize().subtractedFrom (label.getLocalBounds()));
        
        g.drawFittedText (label.getText(), textArea, label.getJustificationType(),
                          jmax (1, (int) (textArea.getHeight() / font.getHeight())),
                          label.getMinimumHorizontalScale());
        
        g.setColour (label.findColour (Label::outlineColourId).withMultipliedAlpha (alpha));
    }
    else if (label.isEnabled())
    {
        g.setColour (label.findColour (Label::outlineColourId));
    }
    
    g.drawRect (label.getLocalBounds(),2);
}
开发者ID:Besegra-Mjolnir,项目名称:TopologyOptimization-1,代码行数:26,代码来源:NTLookAndFeel.cpp

示例4: paintListBoxItem

void StringListBoxModel::paintListBoxItem(const int rowNumber,
        juce::Graphics &g,
        const int width,
        const int height,
        const bool /*rowIsSelected*/)
{
    if (rowNumber < getNumRows())
    {
        g.setColour(juce::Colours::black);
        juce::Font font(height * 0.7f);
        font.setHorizontalScale(0.9f);
        g.setFont(font);
        g.drawText(juce::String(items[rowNumber].c_str()), 4, 0, width - 6, height, juce::Justification::centredLeft);
    }
}
开发者ID:capsocrates,项目名称:SuddenMagic,代码行数:15,代码来源:StringListBoxModel.cpp


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