Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Get font name stored in stream (https://www.delphipraxis.net/181873-get-font-name-stored-stream.html)

WojTec 14. Sep 2014 11:13

Delphi-Version: 5

Get font name stored in stream
 
Getting TTF name from file is not hard, but how about the ones stored in stream? How to do it :?:

Sir Rufo 14. Sep 2014 11:22

AW: Get font name stored in stream
 
Zitat:

Zitat von WojTec (Beitrag 1272513)
Getting TTF name from file is not hard, but how about the ones stored in stream? How to do it :?:

Are you sure with Delphi 5 as you flagged this thread or Delphi XE6 as your profile state?

How do you read the name from the file?

Mostly the file is opend as a stream and then the information is read from the stream ;)

nuclearping 14. Sep 2014 11:23

AW: Get font name stored in stream
 
Can you be more detailed what you mean or try to achieve? :)

Because getting some "file information" stored in a stream is basically the same like getting information from an external file. The only difference is that you need to "locate" and "extract" the file from the stream.

So did you create the stream yourself? Or is it some unknown data format? Because if you created the stream yourself you should know the properties (like position and size) of the files / data you store?

Or do you mean how to "read" from a
Delphi-Quellcode:
TMemoryStream
or
Delphi-Quellcode:
TFileStream
? If yes, then look up
Delphi-Quellcode:
TStream.Read
.

Sir Rufo 14. Sep 2014 11:28

AW: Get font name stored in stream
 
Also have a look at MSDN-Library durchsuchenAddFontMemResourceEx

And on SO there is also an example
http://stackoverflow.com/questions/1...ly-load-a-font

WojTec 14. Sep 2014 14:00

Re: AW: Get font name stored in stream
 
Zitat:

Zitat von Sir Rufo (Beitrag 1272515)
Are you sure with Delphi 5 as you flagged this thread or Delphi XE6 as your profile state?

Website marked themself, I forgot change to higher version :lol:

Zitat:

Zitat von Sir Rufo (Beitrag 1272515)
How do you read the name from the file?

Mostly the file is opend as a stream and then the information is read from the stream ;)

If it will be native Delphi code, then probably will no problem read stream, but I'm using GDI32.DLL@GetFontResourceInfoW:

Delphi-Quellcode:
function GetFontResourceInfoW(lpszFilename: PWideChar; var cbBuffer: DWORD; lpBuffer: PWideChar; dwQueryType: DWORD): DWORD; stdcall;


This is working for both TTF and FON. But they want to see file path, not data pointer.

Zitat:

Zitat von Sir Rufo (Beitrag 1272517)
Also have a look at MSDN-Library durchsuchenAddFontMemResourceEx

Yap, I have routines to load not installed fonts at runtime, but now I want to get name from font stream (stored in some TStream descent). Or in this way can get loaded font name :?:


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:12 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz