Browse Source

Removed the style parameter from Graphics::setFont(), because if the current font doesn't support that style, it'll give the wrong results. If this breaks your code, just wrap your arguments in a Font constructor, e.g. g.setFont (Font (mySize, myStyle));

tags/2021-05-28
jules 13 years ago
parent
commit
f5d72f1406
10 changed files with 16 additions and 21 deletions
  1. +1
    -1
      extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp
  2. +3
    -3
      extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp
  3. +1
    -1
      extras/JuceDemo/Source/demos/WidgetsDemo.cpp
  4. +1
    -1
      extras/audio plugin host/Source/GraphEditorPanel.cpp
  5. +1
    -1
      extras/the jucer/src/utility/jucer_ColourEditorComponent.h
  6. +2
    -5
      modules/juce_graphics/contexts/juce_GraphicsContext.cpp
  7. +3
    -5
      modules/juce_graphics/contexts/juce_GraphicsContext.h
  8. +2
    -2
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp
  9. +1
    -1
      modules/juce_gui_extra/misc/juce_ColourSelector.cpp
  10. +1
    -1
      modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp

+ 1
- 1
extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp View File

@@ -70,7 +70,7 @@ void ItemPreviewComponent::paint (Graphics& g)
RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize,
false);
g.setFont (15.0f, Font::bold);
g.setFont (Font (15.0f, Font::bold));
g.setColour (Colours::white);
g.drawMultiLineText (facts.joinIntoString ("\n"),
10, 15, getWidth() - 16);


+ 3
- 3
extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp View File

@@ -180,10 +180,10 @@ public:
else
g.setColour (Colours::black);
g.setFont (height * 0.7f, Font::bold);
g.setFont (Font (height * 0.7f, Font::bold));
g.drawFittedText (m->uid, height, 0, 200, height, Justification::centredLeft, 1);
g.setFont (height * 0.55f, Font::italic);
g.setFont (Font (height * 0.55f, Font::italic));
g.drawText (m->name, height + 200, 0, width - height - 200, height, Justification::centredLeft, true);
}
}
@@ -547,7 +547,7 @@ struct ProjectSettingsTreeClasses
g.setColour (Colours::black.withAlpha (0.4f));
g.drawRect (0, 28, getWidth(), getHeight() - 38);
g.setFont (14.0f, Font::bold);
g.setFont (Font (14.0f, Font::bold));
g.setColour (Colours::black);
g.drawFittedText (getName(), 12, 0, getWidth() - 16, 26, Justification::bottomLeft, 1);
}


+ 1
- 1
extras/JuceDemo/Source/demos/WidgetsDemo.cpp View File

@@ -195,7 +195,7 @@ public:
g.setColour (Colours::pink);
g.fillEllipse ((float) blobX, (float) blobY, 30.0f, 40.0f);
g.setFont (14.0f, Font::italic);
g.setFont (Font (14.0f, Font::italic));
g.setColour (Colours::black);
g.drawFittedText ("this is a customised menu item (also demonstrating the Timer class)...",


+ 1
- 1
extras/audio plugin host/Source/GraphEditorPanel.cpp View File

@@ -985,7 +985,7 @@ public:
void paint (Graphics& g)
{
g.setFont (getHeight() * 0.7f, Font::bold);
g.setFont (Font (getHeight() * 0.7f, Font::bold));
g.setColour (Colours::black);
g.drawFittedText (tip, 10, 0, getWidth() - 12, getHeight(), Justification::centredLeft, 1);
}


+ 1
- 1
extras/the jucer/src/utility/jucer_ColourEditorComponent.h View File

@@ -51,7 +51,7 @@ public:
Colour (0xffffffff).overlaidWith (colour));
g.setColour (Colours::white.overlaidWith (colour).contrasting());
g.setFont (getHeight() * 0.6f, Font::bold);
g.setFont (Font (getHeight() * 0.6f, Font::bold));
g.drawFittedText (colour.toDisplayString (true),
2, 1, getWidth() - 4, getHeight() - 1,
Justification::centred, 1);


+ 2
- 5
modules/juce_graphics/contexts/juce_GraphicsContext.cpp View File

@@ -214,12 +214,9 @@ void Graphics::setFont (const Font& newFont)
context->setFont (newFont);
}
void Graphics::setFont (const float newFontHeight, const int newFontStyleFlags)
void Graphics::setFont (const float newFontHeight)
{
saveStateIfPending();
Font f (context->getFont());
f.setSizeAndStyle (newFontHeight, newFontStyleFlags, 1.0f, 0);
context->setFont (f);
setFont (context->getFont().withHeight (newFontHeight));
}
Font Graphics::getCurrentFont() const


+ 3
- 5
modules/juce_graphics/contexts/juce_GraphicsContext.h View File

@@ -121,14 +121,12 @@ public:
*/
void setFont (const Font& newFont);
/** Changes the size and style of the currently-selected font.
/** Changes the size of the currently-selected font.
This is a convenient shortcut that changes the context's current font to a
different size or style. The typeface won't be changed.
different size. The typeface won't be changed.
@see Font
*/
void setFont (float newFontHeight, int fontStyleFlags = Font::plain);
void setFont (float newFontHeight);
/** Returns the currently selected font. */
Font getCurrentFont() const;


+ 2
- 2
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp View File

@@ -2448,7 +2448,7 @@ void LookAndFeel::drawTableHeaderColumn (Graphics& g, const String& columnName,
}
g.setColour (Colours::black);
g.setFont (height * 0.5f, Font::bold);
g.setFont (Font (height * 0.5f, Font::bold));
const int textX = 4;
g.drawFittedText (columnName, textX, 0, rightOfText - textX, height, Justification::centredLeft, 1);
}
@@ -2509,7 +2509,7 @@ void LookAndFeel::drawPropertyPanelSectionHeader (Graphics& g, const String& nam
const int textX = buttonIndent * 2 + buttonSize + 2;
g.setColour (Colours::black);
g.setFont (height * 0.7f, Font::bold);
g.setFont (Font (height * 0.7f, Font::bold));
g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
}


+ 1
- 1
modules/juce_gui_extra/misc/juce_ColourSelector.cpp View File

@@ -442,7 +442,7 @@ void ColourSelector::paint (Graphics& g)
Colour (0xffffffff).overlaidWith (currentColour));
g.setColour (Colours::white.overlaidWith (currentColour).contrasting());
g.setFont (14.0f, Font::bold);
g.setFont (Font (14.0f, Font::bold));
g.drawText (currentColour.toDisplayString ((flags & showAlphaChannel) != 0),
previewArea.getX(), previewArea.getY(), previewArea.getWidth(), previewArea.getHeight(),
Justification::centred, false);


+ 1
- 1
modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp View File

@@ -309,7 +309,7 @@ public:
void paintItem (Graphics& g, int width, int height)
{
g.setFont (height * 0.6f, Font::bold);
g.setFont (Font (height * 0.6f, Font::bold));
g.setColour (owner.findColour (KeyMappingEditorComponent::textColourId));
g.drawText (categoryName,


Loading…
Cancel
Save