На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

Installing and Using an Embedded Font



You must separate an embedded font from the containing document and install it in the user's operating system before Windows can use it. Although the exact procedure for separating the font from the document depends on the method used to embed it, your application should always perform these steps:

1. Resolve name conflicts before installing the font.
2. Write the font data to a file, decoding read-only fonts as necessary.
3. Use the CreateScalableFontResource function to create a font resource file for the unembedded font.



In Windows, only a TrueType font can be embedded.
Your application should avoid installing a font with the same name as a font that is already on the system. To determine whether there are duplicate style names, an application can compare the information returned by EnumFontFamilies against the family name and style name stored with the embedded font.

Read-Write Permission

Embedded fonts that have read-write permission (and that therefore can be permanently installed on the user's system) should be written to a file that has the .TTF filename extension.
Most applications put the files for embedded fonts that have read-write permission into either the SYSTEM subdirectory of the user's Windows directory or into the application's working directory. Files for read-only embedded fonts are typically put into a temporary directory.
Before installing an embedded font, you must use the CreateScalableFontResource function to create a font resource file. Because Windows cannot directly interpret the native TrueType font file format, it requires a file that mimics the standard .FON file (called a .FOT file) to make internal bookkeeping and enumeration easier. The CreateScalableFontResource function produces a .FOT file that points to the TrueType font file. Once this .FOT file is produced, Windows applications can use TrueType fonts transparently by using the AddFontResource and RemoveFontResource functions. You can also use the CreateScalableFontResource function to install special fonts for logos, icons, and other graphics. Font resource files for read-only fonts should use a different extension (for example, .FOR) and should be hidden from other applications in the system by specifying 1 for the first parameter of CreateScalableFontResource.

Your application should offer users the option of permanently installing embedded fonts that have read-write permission. To permanently install a font, applications should concatenate the typeface and style names and then use the WriteProfileString function to insert this string along with the .FOT file name in the [Fonts] section of the WIN.INI file. A typical font entry in the [Fonts] section looks like the following example.

Times New Roman Bold (TrueType)=TIMESBD.FOT


Read-Only Permission

Embedded fonts with read-only permission should not use the .TTF extension and should avoid the .FOT and .FON extensions. A typical filename extension for read-only embedded fonts is .TTR. Files for read-only embedded fonts must be removed from the operating system and from both physical and logical memory as soon as the containing document is closed, so their names do not need to be meaningful except to the application.
If a document contains one or more read-only embedded fonts, the user must not be permitted to edit the document. If the user is allowed to edit the document in any way, your application must first strip away and delete the read-only embedded fonts. As mentioned earlier, read-only embedded fonts must be removed from the operating system and memory immediately when the document in which they are bundled is closed.

To delete read-only embedded fonts, your application should follow these steps:

1. Call the RemoveFontResource function for each font to be deleted.
2. Delete the font resource file for each font.
3. Delete each TrueType font file for each font.



When an application creates a file for a read-only embedded font and specifies 1 for the first parameter of the CreateScalableFontResource function, the EnumFonts and EnumFontFamilies functions will not enumerate this font. Hiding read-only embedded fonts in this manner makes it unlikely that another application can use them, even though Windows resources are theoretically available to all processes in Windows. The RemoveFontResource function does not delete a font currently in use. If your application uses a read-only embedded font installed by another application, it can be difficult for the installing application to delete the font. In this case, your application should delete the resource file and the TrueType font file when the user closes the document containing the read-only fonts.

It is very important that applications delete the TrueType font file for read-only embedded fonts. If the delete operation fails when the user closes the document, the application should periodically attempt to delete the file as the application runs, when it closes, and the next time it starts.
In some cases, an application is unable to delete a TrueType font file for a read-only embedded font because of external events (such as a system failure). There is no legal liability for events that are out of the control of the application.


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

Установка и Использование Вложенного Шрифта



Вы должны выделить вложенный шрифт с содержания документа и устанавливать это в операционной системе потребителя прежде, чем Окно может использовать это. Хотя точная процедура чтобы выделять шрифт из документа зависит от метода использованного, чтобы вставлять это, ваше приложение должно всегда выполнить эти шаги:

1. Решите конфликты имени перед установкой шрифта.
2. Запишите шрифтовые данные в файл, декодируя только для чтения шрифты как необходимый.
3. Используйте функцию CreateScalableFontResource, чтобы создавать шрифтовой файл ресурса для unembedded шрифта.



В Windows, только шрифт TrueType может быть вставлен.
Ваше приложение должно избегать устанавливать шрифт с тем же именем как шрифт, который - уже в системе. Чтобы определять есть ли двойные имена стиля, приложение может сравнить информацию возвращанную EnumFontFamilies против фамилии и имя стиля загружалось вложенным шрифтом.

РАЗРЕШЕНИЕ Read-Write

Вложенные шрифты, которые прочитали-разрешение записи (и, что следовательно может навсегда быть установлено в системе пользователя), должно быть записано в файл, что имеет .TTF filename расширение.
Большинство приложений помещают файлы для вложенных шрифтов, которые прочитали-разрешение записи в или СИСТЕМА subdirectory директория пользователя Windows или в прикладной рабочий директорий. Файлы для только для чтения вложенных шрифтов обычно помещены во временный директорий.
Перед установкой вложенного шрифта, Вы должны использовать функцию CreateScalableFontResource, чтобы создавать шрифтовой файл ресурса. Поскольку Windows не может непосредственно интерпретировать исконный шрифтовой файловый формат TrueType, требует файл, который имитирует стандартный файл .FON (названный файл .FOT), чтобы делать внутренней бухгалтерией и перечислением легче. Функция CreateScalableFontResource производит файл .FOT, который указывает на шрифтовой файл TrueType. Как только этот файл .FOT будет произведен, приложения Windows могут использовать шрифты TrueType точно используя AddFontResource и функции RemoveFontResource. Вы можете также использовать функцию CreateScalableFontResource, чтобы устанавливать специальным шрифтам для логотипов, иконок, и другой графики. Шрифтовые файлы ресурса для только для чтения шрифтов должны использовать другое расширение (например, .FOR) и должно быть спрятано из других приложений в системе определяя 1 для первого параметра CreateScalableFontResource.

Ваше приложение должно предлагать опцию навсегда устанавливать вложенные шрифты, которые прочитали-разрешение записи. Чтобы навсегда устанавливать шрифт, приложения должны конкатенировать тип шрифта и имена стиля затем используют функцию WriteProfileString, чтобы включать эту строку вместе с файловым именем .FOT в [Fonts] секции файла WIN.INI. Типичный шрифтовой вход в [Fonts] секции выглядит похожим на следующий пример.

Новый Римский Жирный шрифт Времени (TrueType)=TIMESBD.FOT


РАЗРЕШЕНИЕ Read-Only

Вложенные шрифты с только для чтения разрешением не должны использовать расширение .TTF и должны избегать .FOT и расширений .FON. Типичное filename расширение для только для чтения вложенных шрифтов - .TTR. Файлы для только для чтения вложенных шрифтов должны быть удалены из операционной системы и как из физической так и логической памяти как только содержащий документ будет закрыт, так что их имена не должны значимые кроме в приложение.
Если документ содержит один или более только для чтения вложенных шрифтов, пользователь не должен разрешан редактировать документ. Если пользователь позволен редактировать документ любым путем, ваше приложение должно сначала удалить прочь и удалять только для чтения вложенные шрифты. Как упомянуто, что более ранние, только для чтения вложенные шрифты должны быть удалены из операционной системы и памяти немедленно когда документ в котором они связаны в узел, закрыт.

Чтобы удалять только для чтения вложенные шрифты, ваше приложение должно последовать за этими шагами:

1. Призовите функцию RemoveFontResource к каждому шрифту, который нужно удаляться.
2. Удалите шрифтовой файл ресурса для каждого шрифта.
3. Удалите каждый шрифтовой файл TrueType для каждого шрифта.



Когда приложение создает файл для только для чтения вложенного шрифта и определяет 1 для первого параметра функции CreateScalableFontResource, EnumFonts и функции EnumFontFamilies не перечислит этот шрифт. Только для чтения вложенные шрифты Утаивания в этом способе делает это вряд ли, чтобы другое приложение могло использовать его, даже если ресурсы Windows теоретически пригодные для всех процессов в Windows. Функция RemoveFontResource не удаляет шрифт к настоящему времени в использовании. Если ваше приложение использует только для чтения вложенный шрифт установленный другим приложением, оно может быть трудно для устанавливающего приложения, чтобы удалять шрифт. В этом случае, ваше приложение должно удалить файл ресурса и шрифтовой файл TrueType когда пользователь закрывает документ, содержащий только для чтения шрифты.

Очень важно, чтобы приложения удаляли шрифтовой файл TrueType для только для чтения вложенных шрифтов. Если удалять операцию терпит неудачу когда пользователь закрывает документ, приложение должно периодически пытаться удалять файл как прикладные прогоны, когда оно закрывает, и следующий раз это начинается.
В некоторых случаях, приложение - не в состоянии удалить шрифтовой файл TrueType для только для чтения вложенного шрифта из-за внешних событий (как например, системная неудача). Нет юридической ответственности за события, которая - из управления приложением.


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz