Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to set Font in VLDrawTextLayer
12-18-2011, 11:16 PM
Post: #1
Trying to set Font in VLDrawTextLayer
I'm having a problem trying to set the Font Properties in a VLDrawTextLayer I am using with a VLDSImageDisplay. If I try to set anything other than Font->Size I receive an exception that says something about EPGLoadError FontFamilyNotFound.

For example....

VLDrawTextLayer1->Font->Name = String with good name;
When ran, raises the FontFamilyNotFound exception.

What might I be missing?
Thanks..
Quote this message in a reply
12-18-2011, 11:42 PM
Post: #2
RE: Trying to set Font in VLDrawTextLayer
Hi!

Do you have a font named 'String with good name' ? You should use quotes for the fontname like "Microsoft Sans Serif".

Regards,
Dave
Quote this message in a reply
12-19-2011, 02:32 AM
Post: #3
RE: Trying to set Font in VLDrawTextLayer
Yep, Don't believe the actual properties are the issue, am getting them from a Font Dialogue and saving to variables that I have used many times in other software.

Everything below barfs..

FontName is an AnsiString;
FontColor is an int; // Not sure if this is right but not getting past the name stoped me and I'll deal with it later.
FontStyle is a TFontStyle;

VLDrawTextLayer1->Font->Name = FontName;
VLDrawTextLayer1->Font->Brush->Color = FontColor;
VLDrawTextLayer1->Font->Style = FontStyle;


(12-18-2011 11:42 PM)Dave Wrote:  Hi!

Do you have a font named 'String with good name' ? You should use quotes for the fontname like "Microsoft Sans Serif".

Regards,
Dave


On second thought you may have hit it..

I tried

VLDrawTextLayer1->Font->Name = "Microsoft Sans Serif";

And didn't receive the error.. I noticed the Font Dialogue returns
"MS Sans Serif" which is obviously different...

So guess the real question is how do I get VLDrawTextLayer1->Font to accept the properties returned from a Font Dialogue?
Quote this message in a reply
12-19-2011, 07:11 AM
Post: #4
RE: Trying to set Font in VLDrawTextLayer
Hi, i can recreate this.. Not sure what the reason is, i suggest you send a test-project showing what happens to mr.Mitov to let him investigate.

Regards,
Dave
Quote this message in a reply
12-19-2011, 07:36 AM
Post: #5
RE: Trying to set Font in VLDrawTextLayer
Thanks, I'll mess with it more in the morning and post either my fix or the code that doesn't work.


(12-19-2011 07:11 AM)Dave Wrote:  Hi, i can recreate this.. Not sure what the reason is, i suggest you send a test-project showing what happens to mr.Mitov to let him investigate.

Regards,
Dave
Quote this message in a reply
12-19-2011, 08:01 AM
Post: #6
RE: Trying to set Font in VLDrawTextLayer
Ok, but test-projects are a lot quicker to see/solve issues.. you can mail it to mitov@mitov.com.

Regards,
Dave
Quote this message in a reply
12-19-2011, 08:51 PM
Post: #7
RE: Trying to set Font in VLDrawTextLayer
Yes I could email Mitov but then the next person that has this problem won't know how we fixed it.

Discovered something this morning.. Not all Font Names on the computer work, not sure why but I sorta fixed it with a try.. catch in case the user picks a font name that causes the error.

try { // Not all Font names work
VLDrawTextLayer1->Font->Name = GrabForm->FontName;
}
catch ( ... ) { // Set to something known to work
VLDrawTextLayer1->Font->Name = "Microsoft Sans Serif";
}

This particular computer has a Font named "MS Sans Serif" (among others) that is listed in a TFontDialogue but if you select it you get the error at run time. I don't understand enough about the different type fonts to know why it doesn't work.

This is easily duplicated by simply dropping a TFontDialogue on a form with a VLDrawTextLayer and assigning the TFontDialogue properties to the VLDrawTextLayer.

if(FontDialog1->Execute()) {
VLDrawTextLayer1->Font->Name = FontDialog1->Font->Name;
VLDrawTextLayer1->Font->Size = FontDialog1->Font->Size;
VLDrawTextLayer1->Font->Brush->Color = FontDialog1->Font->Color; // This doesn't wok
VLDrawTextLayer1->Font->Style = FontDialog1->Font->Style;
}
If you pick a good font name everything works as expected except the color. If you leave the color line in, the text will default to transparent regardless of what color you pick in the FontDialogue.

So the next question is how do you assign FontDialog1->Font->Color to VLDrawTextLayer1->Font->Brush->Color?
Quote this message in a reply
12-20-2011, 10:19 AM
Post: #8
RE: Trying to set Font in VLDrawTextLayer
Try this: VLDrawTextLayer1->Font->Brush->Color= GPMakeColor( FontDialog1->Font->Color );

Regards,
Dave
Quote this message in a reply
12-20-2011, 06:39 PM
Post: #9
RE: Trying to set Font in VLDrawTextLayer
No Joy.. GPMakeColor() doesn't exist in anything on this computer and didn't get any hits on Google. What is it?
Quote this message in a reply
12-20-2011, 10:03 PM
Post: #10
RE: Trying to set Font in VLDrawTextLayer
Sorry you're right, first thing i didn't try myself first.. I'll get back on this.

Regards,
Dave
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)