diff --git a/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp b/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp index b630217eec..c400a5b4ff 100644 --- a/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp +++ b/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp @@ -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); diff --git a/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp b/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp index d4d1f58e07..6382b42612 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp @@ -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); } diff --git a/extras/JuceDemo/Source/demos/WidgetsDemo.cpp b/extras/JuceDemo/Source/demos/WidgetsDemo.cpp index d9c852d449..5c9a565ca6 100644 --- a/extras/JuceDemo/Source/demos/WidgetsDemo.cpp +++ b/extras/JuceDemo/Source/demos/WidgetsDemo.cpp @@ -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)...", diff --git a/extras/audio plugin host/Source/GraphEditorPanel.cpp b/extras/audio plugin host/Source/GraphEditorPanel.cpp index 004c3cab4c..2514de2a78 100644 --- a/extras/audio plugin host/Source/GraphEditorPanel.cpp +++ b/extras/audio plugin host/Source/GraphEditorPanel.cpp @@ -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); } diff --git a/extras/the jucer/src/utility/jucer_ColourEditorComponent.h b/extras/the jucer/src/utility/jucer_ColourEditorComponent.h index 0ebee35c5e..eb78751398 100644 --- a/extras/the jucer/src/utility/jucer_ColourEditorComponent.h +++ b/extras/the jucer/src/utility/jucer_ColourEditorComponent.h @@ -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); diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp index 5686e4ec8e..e60de45ba1 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp @@ -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 diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.h b/modules/juce_graphics/contexts/juce_GraphicsContext.h index b75db811bd..141148fbb1 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.h +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.h @@ -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; diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp index c0143b9680..17b359fc66 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp @@ -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); } diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp index 0252915fef..098522362f 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp @@ -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); diff --git a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp index 794f96fa45..5cc1f3f450 100644 --- a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp +++ b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp @@ -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,