I am using a canvas to create a popup "Help" window and want to know if it's possible to center text within the canvas for the title. Then, I have a couple of paragraphs that I'd like to have indented. Is this possible? I have seen other posts that talk about how to bold and/or italicize text using the setFontSettings, but I can't find anything concerning centering/indenting text. Secondly, I'm having trouble changing the font and size of the text. Here's my code:
void showReadMe(DBE xCanvas) {
string sTitle = "Baseline Compare Tool";
font(xCanvas, 1, HeadingsFont);
setFontSettings(8, 0, 2, "Times", true, false);
draw(xCanvas, 250, 25, sTitle);
}
DB readMe = create("Readme", styleCentered|styleFixed);
DBE helpCnvs = canvas(readMe, 800, 600, showReadMe);
show readMe;
No matter what I do to the setFontSettings values, I can't get it to change its size. Please help.
Chris Chris chrscote - Wed Apr 05 13:31:51 EDT 2017 |
Re: Working with text in a canvas Sorry if not answering your question directly, but I figure it could make MUCH more sense to use an htmlView if you plan to show a readme? Regards, Mathias |
Re: Working with text in a canvas My supervisor has said that the script shouldn't have to open other files (don't ask me why). I originally had created regular .doc files and had the menus in my custom dialog window open these files. I think the main reason why he doesn't want to use other files is that he'd rather not have to worry about forgetting to move other files in addition to the script file, but that's just a guess. From what I read in the manual, an htmlView would do the same thing in that I'd have to create an HTML file for the readme. Is it possible to create the HTML file "on the fly" during run-time? If so, I'd love to see an example I can use as a reference. But back to my original question, how do I change the size of the text in the settings?
Chris |
Re: Working with text in a canvas chrscote - Thu Apr 06 08:06:58 EDT 2017 My supervisor has said that the script shouldn't have to open other files (don't ask me why). I originally had created regular .doc files and had the menus in my custom dialog window open these files. I think the main reason why he doesn't want to use other files is that he'd rather not have to worry about forgetting to move other files in addition to the script file, but that's just a guess. From what I read in the manual, an htmlView would do the same thing in that I'd have to create an HTML file for the readme. Is it possible to create the HTML file "on the fly" during run-time? If so, I'd love to see an example I can use as a reference. But back to my original question, how do I change the size of the text in the settings?
Chris Taking this example from the DXL Manual, there are changing font sizes:
void showReadMe(DBE graph) {
background(graph, logicalPageBackgroundColor)
color(graph, logicalDataTextColor)
int x = 10
int fsize
for fsize in 1:90 do {
font(graph, fsize, 0)
draw(graph, x, 20, fsize "")
font(graph, fsize, 1)
draw(graph, x, 60, fsize "")
font(graph, fsize, 2)
draw(graph, x, 90, fsize "")
x+=20
}
}
Does this help? Regards, Mathias |
Re: Working with text in a canvas Thanks Mathias,
From the output, I noticed that for the TextFont (0), the size doesn't really change much. However the HeadingsFont (1) and GraphicsFont (2) the size changes only up to a point, which sort of makes sense in that you wouldn't want the text to get too small, though I would have thought it would go as small as a 4-5pt font. Like this text. but it doesn't. (What if I wanted to make one of those medical labels with all the side effects.
Attachments fontSizes.PNG |