Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP9 font change problem SOLVED with ALLTRIM of fontname

Status
Not open for further replies.

KGHN

Programmer
Jan 7, 2014
3
US
I am an old FoxPro DOS 2.6 programmer, and a new VFP 9.0 one. I also recently moved from an XP Pro work machine to a Windows 7 Home one.
I am trying to convert some programs that rely on the fixed-width (monospaced) fonts with boxes and borders (MSDOS codepage 437).
I found several congenial fonts and set up a table for my programs' users to select and try fonts.
The font changes failed - I got the type size I wanted, but not the typeface. (Windows 7 helpfully changed that to its default Arial.) Confusingly, Foxpro was correctly showing the selected font name when I output _screen.fontname .
I finally figured out that trailing spaces were confusing the font selection. "Foxfont" and "Foxfont " are not the same thing. Using ALLTRIM() on the font name data from my file solved the problem.

May this post save someone some time and trouble...
 
That's because Windows tacks the extension (.fon or .ttf) onto the filename you provide, and spaces are legal in filenames.

However, for future reference you should stop drawing lines altogether. Use the shape object instead. If you continue drawing lines the old fashioned way you have many more unpleasant surprises ahead.
 
Thanks, Dan, for your useful explanation of the behavior I saw.

This project is a retrofit. If it works, it will allow thousands of lines of debugged, experienced code to continue to be useful to their users as machines and operating systems evolve. The programs have users who love them as they are - the applications have been chugging along for 20 years - DOS, Workgroups, W98, W2K, WinXP. Each new environment has needed adaptive tricks to launch the application, get printers to work, and so on.

I also have a new project, which doesn't use monospaced fonts, that is helping me learn how to build an application in VFP9 "the new way". Thanks for the "shape objects" tip.
 
To add: _screen.fontname will only influence any output on the _screen, In forms each control has it's own Font property and defaults to Arial. One more reason to have a base class for every control to centrally be able to set fonts.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top