Jump to content

Spaced text (variable letter and line spacing)


Recommended Posts

@lynxster4 I'll look into it and get back to you.

 

Edit: so far I've found a bug when there's more than one consecutive spaces in the Text field. Is that the case for you? Otherwise could you please post which plugin settings you used? (Text, Fontsize, LetterSpacing, Text aligment, etc.)

 

Edit 2: OK, the bug seems to occur if the area of a line of text is to small (for example because the selection area is too small). This is now fixed. See the update in the opening post.

 

If anyone still experiences issues with the plugin, please don't hesitate to let me know.

Edited by simmetric
  • Upvote 3
Link to post
Share on other sites
11 hours ago, simmetric said:

@lynxster4 I'll look into it and get back to you.

 

Edit: so far I've found a bug when there's more than one consecutive spaces in the Text field. Is that the case for you? Otherwise could you please post which plugin settings you used? (Text, Fontsize, LetterSpacing, Text aligment, etc.)

 

Edit 2: OK, the bug seems to occur if the area of a line of text is to small (for example because the selection area is too small). This is now fixed. See the update in the opening post.

 

If anyone still experiences issues with the plugin, please don't hesitate to let me know.

 

Just tested the revised version.  Did the same steps as yesterday...it didn't crash...which is good.  :)

The only thing I see that is not working properly is the text alignment after you have spaced the letters....like it doesn't recognize that you've expanded the text.

Other than that, good job!   :beer:

Link to post
Share on other sites
12 hours ago, lynxster4 said:

 

Just tested the revised version.  Did the same steps as yesterday...it didn't crash...which is good.  :)

The only thing I see that is not working properly is the text alignment after you have spaced the letters....like it doesn't recognize that you've expanded the text.

Other than that, good job!   :beer:

 

Could you post a screenshot of the settings you use when this happens?

Link to post
Share on other sites

I would recommend tweaking the UI like this:

 

protected override ControlInfo OnCreateConfigUI(PropertyCollection props)
{
	var configUI = CreateDefaultConfigUI(props);

	configUI.SetPropertyControlValue(Constants.Properties.Text.ToString(), ControlInfoPropertyNames.Multiline, true);
	configUI.SetPropertyControlValue(Constants.Properties.Bold.ToString(), ControlInfoPropertyNames.DisplayName, "Formatting");
	configUI.SetPropertyControlValue(Constants.Properties.Bold.ToString(), ControlInfoPropertyNames.Description, Constants.Properties.Bold.ToString());
	configUI.SetPropertyControlValue(Constants.Properties.Italic.ToString(), ControlInfoPropertyNames.DisplayName, string.Empty);
	configUI.SetPropertyControlValue(Constants.Properties.Italic.ToString(), ControlInfoPropertyNames.Description, Constants.Properties.Italic.ToString());
	configUI.SetPropertyControlValue(Constants.Properties.Underline.ToString(), ControlInfoPropertyNames.DisplayName, string.Empty);
	configUI.SetPropertyControlValue(Constants.Properties.Underline.ToString(), ControlInfoPropertyNames.Description, Constants.Properties.Underline.ToString());
	configUI.SetPropertyControlValue(Constants.Properties.Strikeout.ToString(), ControlInfoPropertyNames.DisplayName, string.Empty);
	configUI.SetPropertyControlValue(Constants.Properties.Strikeout.ToString(), ControlInfoPropertyNames.Description, Constants.Properties.Strikeout.ToString());

	configUI.SetPropertyControlValue(Constants.Properties.LetterSpacing.ToString(),
		ControlInfoPropertyNames.SliderLargeChange, 0.25);
	configUI.SetPropertyControlValue(Constants.Properties.LetterSpacing.ToString(),
		ControlInfoPropertyNames.SliderSmallChange, 0.01);
	configUI.SetPropertyControlValue(Constants.Properties.LetterSpacing.ToString(),
		ControlInfoPropertyNames.UpDownIncrement, 0.01);

	configUI.SetPropertyControlValue(Constants.Properties.LineSpacing.ToString(),
		ControlInfoPropertyNames.SliderLargeChange, 0.25);
	configUI.SetPropertyControlValue(Constants.Properties.LineSpacing.ToString(),
		ControlInfoPropertyNames.SliderSmallChange, 0.01);
	configUI.SetPropertyControlValue(Constants.Properties.LineSpacing.ToString(),
		ControlInfoPropertyNames.UpDownIncrement, 0.01);

	return configUI;
}

 

  • Upvote 1
Link to post
Share on other sites

Thanks to @Eli's input I was able to fix a few alignment bugs.

Also many thanks to @BoltBait for the config UI suggestions, these have been worked into the plugin.

 

The zip file in the first post has been updated.

 

Bugs fixed:

- The last line always had a superfluous space at the end (if there's only one line, that's the last)

- Alignment to center or right produced inconsistently positioned lines because of a rounding difference between the functions to measure and render text

 

Thanks for bearing with me!

 

 

9 hours ago, Eli said:

@simmetric The Center alignment is off to the left. There is also a little issue with the Underline and Strikeout options.

 

 

Could you explain what issue you have with the Underline and Strikeout options? It's not immediately clear from the screenshot.

Edited by simmetric
Link to post
Share on other sites

I've just tested new version. Alignment issues seem to be solved and thank you @Eli for posting image for the issue...I couldn't get to it.  :)

 

But, alas....I've found something else.  The AntiAliasLevel slider works at default (2) and 3 and 4.  As soon as you slide it (or use 'up' arrow) to 5 it goes in endless green progress loop, and if you think you can fix it by sliding back to 4, it crashes PDN.  If you try and adjust the slider (from 2) to more than 5, it crashes immediately.

Maybe you could look into it @simmetric.  Thank you!  :)

Link to post
Share on other sites

It's been a busy week but I managed to spend some time on the plugin. Several minor crashing bugs were fixed, and support for IsCancelRequested was added. This means the overall user experience should be better and there should be little to no crashes anymore.

Antialiased text quality is slightly improved.

 

@lynxster4 I hope this fixes the issues you had.

  • Upvote 1
Link to post
Share on other sites

@simmetric When I move the AntiAliasLevel slider to 6  the effect stops and if I try to bring it down to less than 6 Paint.net crashes. I am posting the error. Otherwise, the effect works with the other AntiAliasLevels (1 to 5).

Spoiler

File: C:\Program Files\Paint.NET\Effects\SpacedTextPlugin.dll
      Name: SpacedTextPlugin.SpacedTextEffectsPlugin
      Version: 0.0.0.0
      Author: 
      Copyright: 
      Website: (Not Supplied)
      Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.OutOfMemoryException: Out of memory.
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
   at SpacedTextPlugin.SpacedText.DrawLines(List`1 lines, Graphics gr, Font font, Double letterSpacing, Bitmap bm)
   at SpacedTextPlugin.SpacedText.RenderText(Rectangle bounds)
   at SpacedTextPlugin.SpacedTextEffectsPlugin.OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
   at PaintDotNet.Effects.Effect`1.OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs) in D:\src\pdn\src\Effects\Effect`1.cs:line 65
   at PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 224
   --- End of inner exception stack trace ---
   at PaintDotNet.Effects.BackgroundEffectRenderer.DrainExceptions() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 418
   at PaintDotNet.Effects.BackgroundEffectRenderer.Abort() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 373
   at PaintDotNet.Effects.BackgroundEffectRenderer.Start() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 319
   at PaintDotNet.Menus.EffectMenuBase.<>c__DisplayClass42_3.<RunEffectImpl>b__2() in D:\src\pdn\src\PaintDotNet\Menus\EffectMenuBase.cs:line 953
 

 

Edited by Eli
  • Upvote 1
Link to post
Share on other sites
  • 1 month later...

@xod: the issue with Unicode characters is fixed. Please note that European languages are fully supported (Cyrillic, Maltese, Romanian, etc.) but Asian and Hebrew characters do not support letter spacing.

 

Without letter spacing:

 

SpacedTextUnicode1.png.32a9378ca52a9fc51b65dadcb138f145.png

 

 

With letter spacing:

 

SpacedTextUnicode2.png.a301b644d5d15811d0d1aa0e5d308d0a.png

  • Upvote 4
Link to post
Share on other sites

After experimenting with it for a while, I finally got text justification working in a satisfactory way. It only sizes the spaces between words, so the letter spacing setting is respected inside words.

 

The opening post has been updated with a new version of the plugin that offers a Justify option in the Text alignment dropdown.

SpacedTextJustifySetting.png.be5b3f0f6369444986641b88446866e3.png

 

SpacedTextJustify.png.c52217262c734b60a2029cab94476a19.png

Edited by simmetric
Clarification
  • Like 2
  • Upvote 3
Link to post
Share on other sites
16 hours ago, eggs said:

Hi, I am very new to paint.net and I would like to install this wonderful plugin.  Could someone please explain to me how I go about doing this after I downloaded the .zip file from github.  Thank you.

 

As @AndrewDavid mentioned you're better off with the zip file in the opening post. I'm not sure which zip file you downloaded from Github - I did make some releases which include the zip file you're looking for, but I forgot to do that for the past few versions. So if you downloaded that, then it'll work but it'll be an older version. But more likely you have a zip file with the source code which doesn't run by itself.

 

Just put the files (SpacedTextPlugin.dll and .pdb) in /Program Files/paint.net/Effects/ and start up Paint.NET

 

Thanks for using my plugin!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...