Solved

VMWare Virtual Machine, Windows Server 2003 DataCenter Edition, Apache 2.2.10 and TrueType fonts issue

Posted on 2009-04-06
3
345 Views
Last Modified: 2013-11-25
Hi experts,

I am having an issue with a CGI script written in C++ that lists all fonts installed in the system using Windows API calls.

My script lists all types of fonts when I run it as a standalone program or in Apache installed on my Windows XP machine. But when I run it in the environment described in the Title, it doesn't list any TrueType fonts (OpenType and others are being listed fine).

The CGI script was created in VC6 (UNICODE), but that shouldn't matter it uses the simplest EnumFontFamiliesEx implementation, so it should work.... and yet it doesn't....

Any help would be appreciated


#include "stdafx.h"
 
#include <windows.h>
 
 
int EnumerateFontsClassLibrary();
static int CALLBACK EnumerateFullFontName(const ENUMLOGFONTEX *lpelfe,const NEWTEXTMETRICEX *lpntme, DWORD FontType, LPARAM lParam);
 
 
int iFontCounter;
 
int _tmain(int argc, _TCHAR* argv[])
{
	iFontCounter = 0;
 
	_tprintf(_T("Content-Type: text/plain;charset=us-ascii\n\n"));
 
	EnumerateFontsClassLibrary();
 
	_tprintf(_T("\n\n Found %d fonts."), iFontCounter);
	
	return 0;
}
 
 
static int CALLBACK EnumerateFullFontName(const ENUMLOGFONTEX *lpelfe,const NEWTEXTMETRICEX *lpntme, DWORD FontType, LPARAM lParam)
{
	TCHAR *fontname = (TCHAR *)lpelfe->elfFullName;
	TCHAR *characterset = (TCHAR *)lpelfe->elfScript;
 
	iFontCounter++;
 
	_tprintf(_T("\n"));
	_tprintf(fontname);
 
 
	return 1;
}
 
 
int EnumerateFontsClassLibrary()
{
	HDC dc;
	
	dc=GetDC(0);
 
	LOGFONT logfont;
 
	/*set up default logfont structure*/
    ZeroMemory(&logfont, sizeof LOGFONT);
 
    logfont.lfCharSet = DEFAULT_CHARSET;
 
EnumFontFamiliesEx(dc,														/* handle to device context*/
								&logfont,										/* pointer to logical font information*/
								(FONTENUMPROC)EnumerateFullFontName,			/* pointer to callback function*/
								0,												/* application-supplied data*/
								0																			/* reserved; must be zero*/
								);
 
 
	ReleaseDC(0,dc);
 
	return 0;
}

Open in new window

0
Comment
Question by:cierech
  • 3
3 Comments
 
LVL 2

Author Comment

by:cierech
ID: 24087978
Wow. Really? Nothing? Should I move this over to another Zone?
0
 
LVL 2

Author Comment

by:cierech
ID: 24090617
I have been playing around with this a bit. It seems that the problem is only apparent when Apache is started as a service. If I run it from command line, all the fonts are listed (both TrueType and OpenType).

The user used to run the service and the command line httpd is the same, so that's not the issue...
0
 
LVL 2

Accepted Solution

by:
cierech earned 0 total points
ID: 24142186
For future generations :)

All that was needed was a restart of the 2003 Server. For some reason this is not necessary on windows 2000, xp, vista. But unless I restart the machine, all newly installed TrueType fonts are not seen by Windows API calls when called from a service.

Yay!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Event ID: 1008 / Source: Microsoft-Windows-Perflib 2 161
Active Directory delegation of control to a user 3 100
Web Reply Form - PHP with Upload 4 66
Auto Login Script 3 40
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question