Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Thanks to the following contributors who worked on this release:
- The splatter brush now allows the minimum and maximum splatter size to be configured separately from the brush width
- The status bar color palette now supports Ctrl+clicking to edit a color, in addition to middle clicking (#1436)
- The Resize Image and Resize Canvas dialogs now remember their settings (#1869, #1972)
- The Text Tool now allows choosing the join mode between 'Miter Join', 'Round Join' and 'Bevel Join' (#1969, #1985)

### Changed
- Effect dialogs now hide options that are not currently relevant (#1960)
Expand Down
4 changes: 4 additions & 0 deletions Pinta.Resources/Icons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ public static class Icons
public const string OrientationPortrait = "image-orientation-portrait-symbolic";
public const string OrientationLandscape = "image-orientation-landscape-symbolic";

public const string JoinMiter = "join-miter-symbolic";
public const string JoinRound = "join-round-symbolic";
public const string JoinBevel = "join-bevel-symbolic";

public const string LayerDelete = "layers-remove-layer-symbolic";
public const string LayerDuplicate = "layers-duplicate-layer-symbolic";
public const string LayerFlipHorizontal = ImageFlipHorizontal;
Expand Down
1 change: 1 addition & 0 deletions Pinta.Tools/SettingNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ internal static class SettingNames
internal const string TEXT_ALIGNMENT = "text-alignment";
internal const string TEXT_STYLE = "text-style";
internal const string TEXT_OUTLINE_WIDTH = "text-outline-width";
internal const string TEXT_JOIN = "text-join";

internal const string RECOLOR_TOLERANCE = "recolor-tolerance";

Expand Down
47 changes: 45 additions & 2 deletions Pinta.Tools/Tools/TextTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public TextTool (IServiceProvider services) : base (services)
private Gtk.Separator outline_sep = null!;
private Gtk.SpinButton outline_width = null!;
private Gtk.Label outline_width_label = null!;
private Gtk.Separator join_sep = null!;
private ToolBarDropDownButton join_btn = null!;

protected override void OnBuildToolBar (Gtk.Box tb)
{
Expand Down Expand Up @@ -315,7 +317,39 @@ protected override void OnBuildToolBar (Gtk.Box tb)

tb.Append (outline_width);

outline_width.Visible = outline_width_label.Visible = outline_sep.Visible = StrokeText;
join_sep ??= GtkExtensions.CreateToolBarSeparator ();

tb.Append (join_sep);

if (join_btn == null) {
join_btn = new ToolBarDropDownButton ();

// Translators: 'Miter Join' refers to the Cairo.LineJoin property
join_btn.AddItem (
Translations.GetString ("Miter Join"),
Pinta.Resources.Icons.JoinMiter,
Cairo.LineJoin.Miter
);
// Translators: 'Round Join' refers to the Cairo.LineJoin property
join_btn.AddItem (
Translations.GetString ("Round Join"),
Pinta.Resources.Icons.JoinRound,
Cairo.LineJoin.Round
);
// Translators: 'Bevel Join' refers to the Cairo.LineJoin property
join_btn.AddItem (
Translations.GetString ("Bevel Join"),
Pinta.Resources.Icons.JoinBevel,
Cairo.LineJoin.Bevel
);

join_btn.SelectedIndex = Settings.GetSetting (SettingNames.TEXT_JOIN, 0);
join_btn.SelectedItemChanged += HandleJoinButtonToggled;
}

tb.Append (join_btn);

outline_width.Visible = outline_width_label.Visible = outline_sep.Visible = join_btn.Visible = join_sep.Visible = StrokeText;

UpdateFont ();
}
Expand Down Expand Up @@ -353,6 +387,9 @@ protected override void OnSaveSettings (ISettingsService settings)

if (outline_width is not null)
settings.PutSetting (SettingNames.TEXT_OUTLINE_WIDTH, outline_width.GetValueAsInt ());

if (join_btn is not null)
settings.PutSetting (SettingNames.TEXT_JOIN, join_btn.SelectedIndex);
}

private void HandleFontChanged ()
Expand Down Expand Up @@ -433,11 +470,16 @@ private void HandleItalicButtonToggled (object? sender, EventArgs e)

private void HandleBoldButtonToggled (object? sender, EventArgs e)
{
outline_width.Visible = outline_width_label.Visible = outline_sep.Visible = StrokeText;
outline_width.Visible = outline_width_label.Visible = outline_sep.Visible = join_btn.Visible = join_sep.Visible = StrokeText;

UpdateFont ();
}

private void HandleJoinButtonToggled (object? sender, EventArgs e)
{
UpdateFont ();
}

private void HandleSelectedLayerChanged (object? sender, EventArgs e)
{
UpdateFont ();
Expand Down Expand Up @@ -1075,6 +1117,7 @@ private void RedrawText (bool showCursor, bool useTextLayer)
if (StrokeText) {
g.SetSourceColor (FillText ? CurrentTextEngine.SecondaryColor : CurrentTextEngine.PrimaryColor);
g.LineWidth = OutlineWidth;
g.LineJoin = (Cairo.LineJoin) join_btn.SelectedIndex;

PangoCairo.Functions.LayoutPath (g, CurrentTextLayout.Layout);
g.Stroke ();
Expand Down
Loading