|
02-25-2018, 05:04 PM
|
#1
|
Human being with feelings
Join Date: Jan 2008
Posts: 506
|
ITextControl font?
How does one select a different font for an ITextControl?
Thanks
|
|
|
02-25-2018, 06:46 PM
|
#2
|
Human being with feelings
Join Date: May 2012
Location: PA, USA
Posts: 356
|
With ITextControl, you need to set everything up with the IText that you pass to the control. So, you would do something like this...
Code:
IText lFontWhite(20, &COLOR_WHITE, "Futura", IText::kStyleNormal, IText::kAlignCenter, IText::kAlignMiddle, 0, IText::EQuality::kQualityClearType, &COLOR_BLACK);
pGraphics->AttachControl(new ITextControl(this, thisRect, &lFontWhite, "something"));
You just need to make sure that whatever font you use will be installed on the users' computers. If it is not a system font, you need to include it in the installer.
|
|
|
02-25-2018, 08:46 PM
|
#3
|
Human being with feelings
Join Date: Jan 2008
Posts: 506
|
Thanks. Following your example I'm finding the font property not changing, although most of the other properties reflect changes made to them. I'm after a fixed spaced font such as Terminal which would be on every system. Is there anything else I need to do to make the fonts available?
(PS the code snippet has one too many alignment properties)
|
|
|
02-26-2018, 04:20 AM
|
#4
|
Human being with feelings
Join Date: Jan 2008
Posts: 506
|
The only fonts I can display in my plugin are the ones in the ITextControl example plugin. The control panel fonts dialog has lots of fonts but they seem to be installed already.
|
|
|
02-26-2018, 12:06 PM
|
#5
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
Have you looked into using Cairo fonts? I'm bundling a custom font in the resources of my plug and can use that across all my controls. It's possible to use more than one font as well with extra work. Here's a thread about it:
https://forum.cockos.com/showthread.php?t=197181
My code on the last post can be optimised, as it's creating the text path twice - once for the outline and once for the fill, where it only needs to create the path once and instead of the first cairo_stroke use cairo_stroke_preserve.
|
|
|
02-26-2018, 04:42 PM
|
#6
|
Human being with feelings
Join Date: Jan 2008
Posts: 506
|
Quote:
Originally Posted by Bobflip
Have you looked into using Cairo fonts?
|
I definitely want to use cairo. ATM the Youlean framework is crashing with my current plugin, so I'm kind of waiting for some clarity on that...
|
|
|
03-06-2018, 02:47 AM
|
#7
|
Human being with feelings
Join Date: Jan 2008
Posts: 506
|
Quote:
Originally Posted by Bobflip
Have you looked into using Cairo fonts? I'm bundling a custom font in the resources of my plug and can use that across all my controls. It's possible to use more than one font as well with extra work. Here's a thread about it:
https://forum.cockos.com/showthread.php?t=197181
My code on the last post can be optimised, as it's creating the text path twice - once for the outline and once for the fill, where it only needs to create the path once and instead of the first cairo_stroke use cairo_stroke_preserve.
|
Having success using this recipe!!! I can use any font now. I simplified the text rendering to single layer. Otherwise I noticed the speed slowdown (my patch editor librarian view shows groups of 128 patches, thats a lot of text!)
Still don't know why my font choice was so limited with WDL-OL, but its great to be using Cairo graphics now, it is certainly very powerful for rich graphics.
|
|
|
02-26-2018, 01:58 PM
|
#8
|
Human being with feelings
Join Date: May 2012
Location: PA, USA
Posts: 356
|
Quote:
Originally Posted by Guod3
Thanks. Following your example I'm finding the font property not changing, although most of the other properties reflect changes made to them. I'm after a fixed spaced font such as Terminal which would be on every system. Is there anything else I need to do to make the fonts available?
(PS the code snippet has one too many alignment properties)
|
Sorry, I modified the code for vertical alignment (which I am not really using anyway).
You just need to make sure the font is installed on the computer, and the name you are using is the same name as the font. If there are any problems with the name, it will default back to a system font. I forget what that is for a Mac/PC.
|
|
|
02-26-2018, 04:50 PM
|
#9
|
Human being with feelings
Join Date: Jan 2008
Posts: 506
|
Quote:
Originally Posted by random_id
You just need to make sure the font is installed on the computer, and the name you are using is the same name as the font. If there are any problems with the name, it will default back to a system font. I forget what that is for a Mac/PC.
|
I've looked at the control panel/fonts dialog (Windows 7). When I inspect a sample of a font there is a greyed out button "install", so I'm assuming its installed already. Is the name you use the same as the caption of the font icon? I've noticed there is a font filename in the properties that is different and has an extension e.g *.fon
|
|
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:29 PM.
|