-
-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] - (Improving Text Tools - Text outline expansion direction, Text directly on image, Justify, more font/outline antialiasing options) #428
Comments
Thank you for these excellent suggestions, @0lm ! Detailed feedback like this is so valuable. Let me get the new 9.0 stable release out the door (planned for the next few days), then we can talk more about these features. I'll provide a more detailed update once 9.0 has released. 🙏 |
Relates to #428 I also cleaned up some other icons while here, so the resource size has actually shrunk slightly from its previous version.
Relates to #428 Because one text tool will support justified text (advanced text) and one will not (basic text), extra mapping code is needed to ensure text layers can still be converted between the two types. This commit also adds the necessary UI for a new "justified" alignment, but the justification algorithm has *not* been implemented yet
...with whitespace characters. (We can expand the line only in the whitespace locations.) Relates to #428 . The canonical best-case implementation of this feature would be the Knuth-Plass linebreaking algorithm: http://eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf I'd love to tackle that someday, but I've yet to fully wrap my brain around it. Instead, this commit uses a straightforward greedy approach that was easy to slot into PD's existing line-breaking algorithm. Still TODO: + justifying lines that have no whitespace chars + variable handling of the last line in a paragraph (the user should really have control over this, like Photoshop provides)
Relates to #428 - Lines with whitespace are now justified using whitespace only. - Lines without whitespace are justified using inter-character spacing. - A ton of weird edge-cases have been addressed and fixed (seriously, there are a lot of ways for justified text to go horribly wrong) Next up is a UI for the user to select trailing line justification behavior. (Photoshop allows the user to select between left/center/right/justified for just the trailing line, as a separate setting - and it's a nice feature.) Still TODO is handling multi-paragraph text. Technically the trailing line setting should apply to the trailing line of *each* paragraph in a text layer, but I want to get it working for *just* the last line of *all* paragraphs before I tackle that.
...now user-controllable, with full support for last-line alignment to the left, center, right, or fully justified like the preceding paragraph! Relates to #428 Photoshop is the only other photo editor (at all, to my knowledge) that provides this level of control over text justification. Most photo editors don't provide justified alignment at all, and even those that do (GIMP) fail to handle multi-paragraph text layers correctly. All these cases are now handled correctly in PhotoDemon, and the user has full control over the process. Big win for us, IMO 👍 (Also, the new setting can of course be persisted to/from PDI files, as expected.)
A toggle is now available to render advanced text in Fill > Outline or Outline > Fill order. This achieves the "only expand outline outward" goal: Next up, I'm going to explore the possibility of an additional "smooth" antialiasing option. I'll be honest - this one may not be achievable, because I have no idea how Photoshop's antialiasing algorithm operates, so I'm shooting blindly here. But I have a few ideas that may work "close enough". I'll report back soon! |
Relates to #428 . Thank you to 0lm for the suggestion. The advanced text tool now lets you render text in either fill > outline, or outline > fill order. This can improve the clarity of filled+outlined text, especially at small font sizes and/or large outline stroke widths.
Relates to #428 . Thank you to @0lm for the suggestion! This new setting is primarily useful for softening glyph edges at large sizes; at small sizes, the aggressive edge sampling may be undesirable. Note also that PhotoDemon exposes font hinting as a separate setting. (In Photoshop, hinting is "merged" into the various antialiasing settings.) This allows for a comprehensive range of glyph fit options by mixing both hinting *and* antialias settings in PD.
Advanced Text tool improvements and new features. Solves #428 . Many thanks to @0lm for submitting a detailed feature request! This pull request adds the following features to the advanced text tool. + Justified text alignment. Most photo editors do not expose this feature because it's complicated to implement, and native text renderers frequently do not support this at a library level. (For example, Windows provides no native way to draw justified text, whether via GDI or GDI+. [DirectWrite finally supported this in Windows 8](https://docs.microsoft.com/en-us/windows/win32/directwrite/justification--kerning--and-spacing), but alas that doesn't help me in PhotoDemon since I need to support XP/Vista/7, too!) Anyway, long story short is that PhotoDemon's justified alignment is implemented manually. Please let me know if you encounter any oddities. + Justified text alignment supports multiple paragraphs in a single text layer, with custom control over last-line (trailing) behavior. Trailing line behavior has its own justification setting and it can be left/center/right/jully justified independent of the paragraph as a whole. + Text fill and outline can now rendered in either order (outline above fill, or fill above outline). + A new "smooth" antialias setting is now exposed, in additional to the previous "none", "normal", "crisp" settings. Note that Photoshop exposes an additional "strong" setting, but PhotoDemon's settings do not map 1:1 to Photoshop's by design, because PD exposes hinting as its own property (whereas Photoshop mixes that into its antialiasing settings). So if you're trying to match Photoshop settings - which alas is not 100% possible due to underlying font rendering differences - remember to play with both antialiasing AND hinting to achieve the look you want.
Hi 0lm. Your requested text tool features are now available in nightly builds. Justified text alignment, "fill above outline", and expanded antialiasing options have all been implemented. The one feature I cannot currently complete is the "edit text directly on image" request. Because PhotoDemon supports non-destructive rotation and shear on text layers, it would be incredibly difficult to support text editing directly on the image. (Similarly, features like "justified text alignment" are actually feasible for me to implement because they do not need to support interactive text editing!) For the time being, I need to keep editing in a "traditional" system text box because the alternative would require many months of work, and I feel that other features are a more constructive use of my limited development time. Thank you again for your excellent feedback and detailed feature request! |
Hey. Sorry for the late response. I tested the new features by now, and they make working with texts in PhotoDemon alot more comfy and easier, thanks for that! I hope it is not much to ask, but is it possible to add another feature like "templates"? So, one can quick-select between pre-configured text templates. Examples:
Like, the ability to pre-define text settings and save them as templates, and to be able to quick.switch between them, instead of needing to go through all the settings once again, whenever you want to change something? |
JFYI, these "templates" are called "styles" in MS Word and most other text processors and desktop publishing tools and can have heirarchical definition i.e. Style 1 based on Normal, etc. |
Text styles are just effectively saved presets, like all the other image filters support |
Is this feature request related to a problem?
Not that I know of. No Problems so far. But some inconvenient features could be bugs, since I am not sure if some things were intended to work that way or not.
Describe the best way to implement this.
First of all, thanks for your work and this awesome software. I like to use it, since it is very light and easy to use. Personally, I use text tools alot. And I noticed some things missing. Maybe you agree and would like to add them. Let's try our luck:
Text directly on image: All in one, the text tools are very good. Alot better than other image text tools. But some features are missing/are inconvenient. First, is it possible to add the ability to write directly onto the image? Right now, I don't seem to be able to write on the image itself, but rather on a seperate text box after clicking "edit text".
Justify: Another point I noticed, is: You have align left, right and center for text positions. Is it poossible to also add an option to justify the text?
Text outline expansion direction (inner, outer, mid): Then, about the text outlining: I noticed the text outlining goes into the inner. That means, the thicker the outline, the more it will cover the real inner color of the text. Is it possible to add an option, to change outline to the outer? So, even if the outline is very thick, it will expand to the outer, so it won't cover the real text color anymore. Right now I couldn't find any options to control the expansion direction of text outlines.
More antialiasing: Also, is it possible to add more different antialiasing options for fonts and outlines, for example "round" to make it look more smooth? I think there are also others existing in other image editors like strong, sharp etc.
I apologize in advance if some (or all) of these features are already present. But somehow I couldn't find them. Btw the versions I used were the beta release from 16th August, and later the nightly downloaded 6th September
Thank you!
If this feature makes it into PhotoDemon, I am happy to add your name to PhotoDemon's contributor list. Please let me know what name (and optional website link) you'd like me to use.
The text was updated successfully, but these errors were encountered: