Win32 RichEdit align paragraph vertically - c++

I need to align paragraph vertically (top, center, bottom) in a RichEdit.
I googled it and found nothing about this issue. Does anybody know a workaround
to achive this. I use C++ Builder 2010, are there any VCL or Windows API way solution?

I don't think TRichEdit supports Vertical Text Alignment. For example take this tiny RTF document:
{\rtf1\ansi\ansicpg1250\deff0\deflang1048{\fonttbl{\f0\fnil\fcharset0 Calibri;}}\viewkind4\uc1\pard\sa200\sl276\slmult1\qc\lang9\f0\fs22\vertalc Text\par}
When this is put into TRichEdit the "Text" is only aligned horizontally. Open the document with WordPad and it looks absolutely the same. Open it up with Ms Word and the "Text" is centered both vertically and horizontally in the page. Since TRichEdit doesn't support the \vertalc, there's no need for any kind of API to set that attribute.

Related

Gtk3+ Spinbutton in vertical orientation (c/c++)

I'm pretty sure there is a easy way to do this… but I'm not so proficient with GTK3 (coding in C/C++) at this moment, and i'm finding myself stuck looking how can I create a new GtkSpinButton having the "+" and "-" buttons upper and below the entry text box instead as they are shown by default (at the right side of text entry).
I looked around in the documentation and a bunch of websites without look, but I see that there are spinbutton.horizontal and spinButton.vertical CSS classes… so I think there should be a way to simply instantiate the widget programmatically in vertical mode instead of horizontal.
Any help/hints on this, please?
Well… after a bit more research, I did find/learn about the GtkOrientable interface and GtkSpinButton being one of the widgets implementing this, so gtk_orientable_set_orientation() did the trick!

cocos2d-x label text char spacing

I use cocos2d:::Label and I need to control the spacing of adjustment characters in the text. I use cocos2d-x 3.0 and the font of the label is TTF. Is it possible to achieve, or I should use another thing instead of cocos2d:::Label?
I figured out that bitmap fonts can be created with appropriate inter-character spacing. There is a good online tool for that. And it can customize even more settings, and it is very handy.

Vertical centering of multi-line cstatic text in MFC

How can one make a CStatic with text auto-wrap (multiline) which vertically centeres the result in the control's rectangle?
The problem I'm trying to solve is this: I have a CStatic control next to a CComboBox which updates information text depending on the choice. This text can be either short or long, requiring the CStatic to sometimes use multi-lines, and sometimes not. I want the info-text be vertically center-aligned with the CComboBox.
Now here is the problem:
If I make the CStatic only 1 textline high, it looks good for 1-line texts, but multi-lines do not fit and are not displayed.
If I make the CStatic higher to fit 2 lines, it looks good for long texts (with 2 lines), but 1-line-texts are shifted upwards, as the CStatic aligns the text on the top. A CStatic with the behavior mentioned in the question would solve this...
If I can't easily get a vertically centered CStatic multi-line control, the alternative would be to resize the control rect depending on the amount of text in it. But in this case I have a different problem:
How can I programatically find out how many lines a text will need in a CStatic of specific width?
Unfortunately you can't vcenter multi-line text in a CStatic.
Your next question has a solution but it's a bit of a pain to use. What you do is you use CDC::DrawTextEx with the DT_CALCRECT flag to get the size (in pixels) of the text you want to format. By dividing that by the height of a line of text (given in the font info you can get from the DC, plus some spacing which I'm not sure of how much that is - presumably it's a fixed amount, I don't think you can specify line spacing with DrawText), you will get (an approximation of) the number of lines you will get. You can then resize the control rect.
Come to think of it, you are probably better off not converting to lines and just resize your control to the extent you get from DrawTextEx :)
Things like this usually require some experimentation to get exactly right, and sometimes behave differently between OS versions. Proceed with caution.

Rich Text Editor Recommendation - Needs support for image upload and resizing

I am looking for WYSIWYG rich text editor to use with Django. I've looked at a number of different editors (CKEditor, TinyMCE, Aloha, YUI), but I can't seem to find one that has one necessary feature: dynamic image resizing.
What I mean by that is the ability to click a corner of the image in the editor and drag your mouse to resize the image. Content around the image should then adapt to the new image size. As well, the editor needs to have image upload functionality.
Any recommendations?
It's fine if its an editor+plugin combo. Ideally it would also integrate nicely with Django.
Thanks for the help!
Yup. I came to the same conclusion too. django-ckeditor is really easy to use.
Froala and Redactor are perfect for your case. They're paid though.
QuillJS is a free alternative that allows image manipulations by inserting the image directly as a base64 encoded string.

Is there a way to make c++ console text larger?

I'm making a random number generator, the program will create several random numbers and then choose from those random numbers and then displays that number in the window.
I was wondering if there was a way to make that specific piece of text bigger?
I don't want to change the size of all of the text in the window as I have writing in the window that i don't want to change the size of
Thanks for any help you can give
No, but you can make it bold, change the font color, or the background color for the specific text. If all you want is to make that specific piece of text stand out, I'd go with colorizing it.
As for how to do that... It's platform dependent. What platform are you on? Windows? Linux? What shell?
Take a look at the Windows Console API. That should have what you need.
Console text doesn't allow for the rich formatting you are referring to. You would have to move to a graphical output to render the size differences.
Generally, programs can't control the size of the text in the terminal. You may be able to change the color of a specific part of the text, though. Search for terminal escape sequences for information on how to do that on various terminals. Some terminals also handle bold, italics, and underlining.
No, but instead you can change colors of text and text's background. Will this be a good solution for your problem? There are a lot of specific examples available in the internet.
A possible console mode solution could involve FIGlet. You can tweak the output to write in many different fonts.
The output is larger, but no guarantee that it's suitable for your application.
open your console app, go to system menu of console window (left top corner, right click), font tab, choose what you wish. next time you open this (!) console app the font will be as you selected, other console windows are not affected
Right Click the top bar of the window
Click Properties
Click Font and select your font size
This isn't through the code but it will help for your pc.