CustomFont
所属分类:GDI/图象编程
开发工具:Visual C++
文件大小:87KB
下载次数:2
上传日期:2017-03-29 16:07:52
上 传 者:
xah18
说明: Windows 编程实例,DirectWrite例子,自定义字体例子。
(Windows programming examples, directwrite example, custom font example )
文件列表:
CustomFont\Common.h (2786, 2010-04-19)
CustomFont\CustomFont.cpp (8567, 2010-04-19)
CustomFont\CustomFont.h (493, 2010-04-19)
CustomFont\CustomFont.manifest (1279, 2010-04-19)
CustomFont\CustomFont.rc (1427, 2010-04-19)
CustomFont\CustomFont.sln (1239, 2010-04-19)
CustomFont\CustomFont.vcproj (10196, 2010-04-19)
CustomFont\Fonts\kooten.ttf (42164, 2010-04-19)
CustomFont\Fonts\peric.ttf (82988, 2010-04-19)
CustomFont\Layout.cpp (4781, 2010-04-19)
CustomFont\Layout.h (828, 2010-04-19)
CustomFont\resource.h (699, 2010-04-19)
CustomFont\ResourceFontCollectionLoader.cpp (2326, 2010-04-19)
CustomFont\ResourceFontCollectionLoader.h (1660, 2010-04-19)
CustomFont\ResourceFontContext.cpp (2544, 2010-04-19)
CustomFont\ResourceFontContext.h (956, 2010-04-19)
CustomFont\ResourceFontFileEnumerator.cpp (2504, 2010-04-19)
CustomFont\ResourceFontFileEnumerator.h (1628, 2010-04-19)
CustomFont\ResourceFontFileLoader.cpp (2780, 2010-04-19)
CustomFont\ResourceFontFileLoader.h (1555, 2010-04-19)
CustomFont\ResourceFontFileStream.cpp (3405, 2010-04-19)
CustomFont\ResourceFontFileStream.h (1818, 2010-04-19)
CustomFont\Fonts (0, 2016-05-23)
CustomFont (0, 2016-05-23)
CustomFont
Demonstrates
============
How to render fonts that are embedded as resources. This application implements
a custom font file loader to provide access to the embedded font data. This
allows DirectWrite to recognize the family name of the fonts even though these
fonts are not installed on the system. The sample shows how to:
- Implement a custom font file loader, which provides access to font data using
an integer resource ID as the font file key.
- Implement a custom font collection loader, which enumerates font files using
an array of integer resource IDs and the font collection key.
- Create a custom font collection comprising two fonts - Pericles and Kootenay -
from the Sample OpenType Font Pack.
- Format and render some text in these fonts in the application window.
Languages
=========
This sample is available in the following language implementations:
C++
Files
=====
CustomFont.cpp: Main application entry point and window.
Layout.cpp: Macro layout that draws smaller layouts as formatted paragraphs.
ResourceFontContext.cpp: Registers and creates the custom font collection.
ResourceFontCollectionLoader.cpp: IDWriteFontCollectionLoader implementation.
ResourceFontFileEnumerator.cpp: IDWriteFontFileEnumerator implementation
ResourceFontFileLoader.cpp: IDWriteFontFileLoader implementation.
ResourceFontFileStream.cpp: IDWriteFontFileStream implementation.
Common.h: Common definitions and system files.
resource.h: Menu command identifiers.
Prerequisites
=============
Windows 7 with DirectWrite and D2D.
Windows Software Development Kit (SDK) for Windows 7.
Building the Sample
===================
Include instructions as numbered steps. For example:
To build the sample using the command prompt:
---------------------------------------------
1. Open the Command Prompt window and navigate to the directory.
2. Type msbuild CustomFont.sln.
To build the sample using Visual Studio 2008 (preferred method):
----------------------------------------------------------------
1. Open Windows Explorer and navigate to the directory.
2. Double-click the icon for the .sln (solution) file to open the file in
Visual Studio.
3. In the Build menu, select Build Solution. The application will be built
in the default \Debug_[x***/Win32] or \Release_[x***/Win32] directory.
Running the Sample
==================
1. Navigate to the directory that contains the new executable,
using the command prompt or Windows Explorer.
2. Type CustomFont.exe at the command line, or double-click the icon for
CustomFont.exe to launch it from Windows Explorer.
3. The window will then draw the custom fonts.
Close the window when done.
近期下载者:
相关文件:
收藏者: