New text mode: Justify

Posted on:November 11 2011

I just implemented a small new feature for my tiny WYSIWYG website editor WebsitePainter: The possibility to justify align text in the editor:

This is one of the sitations where it pays back that I wrote the whole text editor myself, instead of relying on some existing control, or maybe even the operating system provided text editor. The original decision for writing my own editor control from scratch was because usually, any generic text editor control never would format text exactly like HTML would do this. Like how it would line wrap words, for example. Or support advanced features, like displaying hyperlinks. But the big advantage I now have is the possibility to be able to extend the control myself easily. Adding the justify align text feature took me about 5 minutes, which is great.
BTW: If you want to write your own text editor as well, think twice: It is incredible time-consuming to implement a text edit control from scratch, even without fancy features such as free text formatting. You really get a bit respect for what your operating system is doing when you tell it to create a small text field. :)


Why not base you work on a web-browser's edit mode ? You'd get perfect HTML layout and editing for "free".
Bitwise, I tried myself to implement a text editor for fun once, and I agree, this is very time-consuming but very interesting ;)
2011-11-11 18:17:00

justified text should only be used if there also is well working hyphenation. those big holes in the text look really ugly otherwise. that's very bad typography.

also, your right text border doesn't look very straight. :)
2011-11-12 14:13:00

@John: Ever tried embedding a browser in your code? Very much overhead and lots of dependencies.
@horace: You are right, but that's how it looks in HTML. Yes, the right border is not exact, I'm missing a pixel here and there, going to correct this.
2011-11-13 17:53:00

@Niko I tried Chromium Embedded and it was a single DLL as far as I can remember:
Problem though is that HTML edit is somewhat limited in WebKit based web-browsers.
Mozilla has the XulRunner package but I haven't tried it yet:
2011-11-13 20:03:00

Add comment:

Posted by:

Enter the missing letter in: "Internatio?al"




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]