Previous Thread
Next Thread
Print Thread
//settextcolor #29258 28 Jun 15 08:20 PM
A
Anonymous
Unregistered
Anonymous
Unregistered
A
Is there any way I can use settextcolor to change text color for certain characters within a line of text. That is, certain words need to be a different color.

When I print one section of text, I terminate the print statement with a ";". That means that the //settextcolor command that follows to change the color for the next section of text is at the end of the line, and is not acted upon as a PDFX command.

Re: //settextcolor #29259 28 Jun 15 11:49 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
The trick for changing GDI settings (color, font, etc.) in the middle of a line is somewhat buried in the documentation ( Writing GDI Directives - 6th bullet point), but it is similar to UNIX shell prompt syntax, i.e. ending a line with a backslash holds the position:

Code
//;test changing color in middle of line
//SETMAPMODE,LOENGLISH
//SETTEXTCOLOR,0,0,255
This is blue, \
//SETTEXTCOLOR,255,0,0
this is red, \
//SETTEXTCOLOR,0,0,255
back to blue.
//SETTEXTCOLOR,0,0,0
And this is black.
[Linked Image]

Perhaps it would be nice to implement some kind of HTML/CSS-like shortcut to make it a bit simpler to toggle betweeen effects in the middle of a line?


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3