Veröffentlicht 18. April 200223 j Hi! Ich hab mal wieder ne Frage: Wie kann in in Visual C++ meine Fonts (Schriftarten) die auf meim System gespeichert sind einlesen und in einer Dialogbasierten Anwendung in Form einer Liste wieder ausgeben???? Wär net schlecht, wenn mir jemand weiter helfen könnte! DANKE!
18. April 200223 j Also damit kannst Du direkte Pixelfonts von den Systemfonts auslesen und direkt verwenden: Einfach ein CFont Objekt erzeugen und dann CreatePointFont entsprechend dafür aufrufen. Wie das mit der Enumeration genau funktioniert hab ich noch nicht probiert, aber damit kannst Du dann alle zur Verfügung stehenden Fonts namentlich bekommen. CFont::CreatePointFont BOOL CreatePointFont( int nPointSize, LPCTSTR lpszFaceName, CDC* pDC = NULL ); Return Value Nonzero if successful, otherwise 0. Parameters nPointSize Requested font height in tenths of a point. (For instance, pass 120 to request a 12-point font.) lpszFaceName A CString or pointer to a null-terminated string that specifies the typeface name of the font. The length of this string must not exceed 30 characters. The Windows EnumFontFamilies function can be used to enumerate all currently available fonts. If lpszFaceName is NULL, the GDI uses a device-independent typeface. pDC Pointer to the CDC object to be used to convert the height in nPointSize to logical units. If NULL, a screen device context is used for the conversion. und hier noch für die Enumeration: EnumFontFamilies The EnumFontFamilies function enumerates the fonts in a specified font family that are available on a specified device. EnumFontFamilies and EnumFontFamProc are maintained for compatibility with 16-bit versions of Windows. Win32-based applications should call the EnumFontFamiliesEx function. int EnumFontFamilies( HDC hdc, // handle to device control LPCTSTR lpszFamily, // pointer to family-name string FONTENUMPROC lpEnumFontFamProc, // pointer to callback function LPARAM lParam // pointer to application-supplied data ); Parameters hdc Handle to the device context. lpszFamily Pointer to a null-terminated string that specifies the family name of the desired fonts. If lpszFamily is NULL, EnumFontFamilies randomly selects and enumerates one font of each available type family. lpEnumFontFamProc Specifies the procedure-instance address of the application-defined callback function. For information about the callback function, see EnumFontFamProc. lParam Pointer to application-supplied data. The data is passed to the callback function along with the font information.
23. April 200223 j Kommt darauf an was du machen willst. CFontDialog hilft in dialogfeldbasierten Anwendungen meist weiter.....
23. April 200223 j Der ist nur für die Direktwahl, aber wenn er die Namen und Eigenschaften auslesen will kommt er damit nicht weit.
23. April 200223 j Will sie ja in einer Liste ausgeben....etwas anderes macht CFontDialog auch nicht. Wenn er die Namen irgendwie speichern will etc. dann geht das aber über CFontdialog auch, nur etwas umständlich, aber mich würde interessieren wo man sowas denn braucht????
23. April 200223 j Z.B. wenn man den voreingestellten Zeichensatz auf der Zielmaschine nicht vorliegen hat. Ein Kumpel von mir macht gerade für eine Versicherung eine Oberfläche, welche aber bei einem mit W95 ausgestatteten Laptop lustigerweise WingDings benutzt, weil der verwendete Zeichensatz offensichtlich dort nicht installiert war. Da kann eine Zeichensatzauswahl fürs Programm schon hilfreich sein. Aber stimmt schon - mit CFontDialog spart man sich einiges an Arbeit.
24. April 200223 j HI! Ich brauch das, um die Namen,der auf dem System vorhandenen Schriftarten mit Schriftarten, die in einer .txt Datei gespeichert sind zu vergleichen! Da wir ein Programm vertreiben, das bestimmte Schriftarten benötigt, um Daten auszuspielen und sie in einem Katalog anzuzeigen!
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.