📄 usp10.h
字号:
/*++
Copyright (c) 1998-1999 Microsoft Corporation.
*/
#ifndef __usp10__
#pragma option push -b -a8 -pc -A- /*P_O_Push*/
#define __usp10__
#if _MSC_VER > 1000
#pragma once
#endif
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
///// Uniscribe build number
#define USPBUILD 0306
///// USP - Unicode Complex Script processor
//
// Copyright (c) 1996-9, Microsoft Corporation. All rights reserved.
///// SCRIPT
//
// The SCRIPT enum is an opaque type used internally to identify
// which shaping engine functions are used to process a given run.
//
//
#define SCRIPT_UNDEFINED 0
//
//p SCRIPT_UNDEFINED: This is the only public script ordinal. May be
// forced into the eScript field of a SCRIPT_ANALYSIS to disable shaping.
// SCRIPT_UNDEFINED is supported by all fonts - ScriptShape will display
// whatever glyph is defined in the font CMAP table, or, if none, the
// missing glyph.
///// USP Status Codes
//
#define USP_E_SCRIPT_NOT_IN_FONT \
MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200) // Script doesn't exist in font
///// SCRIPT_CACHE
//
// Many script APIs take a combination of HDC and SCRIPT_CACHE parameter.
//
// A SCRIPT_CACHE is an opaque pointer to a Uniscribe font metric cache
// structure.
typedef void *SCRIPT_CACHE;
// The client must allocate and retain one SCRIPT_CACHE variable for each
// character style used. It must be initialised by the client to NULL.
//
// APIs are passed an HDC and the address of a SCRIPT_CACHE variable.
// Uniscribe will first attempt to access font data via the SCRIPT_CACHE
// and will only inspect the HDC if the required data is not already
// cached.
//
// The HDC may be passed as NULL. If data required by Uniscribe is
// already cached, the HDC won't be accessed and operation continues
// normally.
//
// If the HDC is passed as NULL, and Uniscribe needs to access it for
// any reason, Uniscribe will return E_PENDING.
//
// E_PENDING is returned quickly, allowing the client to avoid time
// consuming SelectObject calls. The following example applies to all
// APIs that take a SCRIPT_CACHE and an optional HDC.
//
//c hr = ScriptShape(NULL, &sc, ..);
//c if (hr == E_PENDING) {
//c ... select font into hdc ...
//c hr = ScriptShape(hdc, &sc, ...);
//c }
///// ScriptFreeCache
//
// The client may free a SCRIPT_CACHE at any time. Uniscribe maintains
// reference counts in it's font and shaper caches, and frees font data
// only when all sizes of the font are free, and shaper data only when
// all fonts it supports are freed.
//
// The client should free the SCRIPT_CACHE for a style when it discards
// that style.
//
// ScriptFreeCache always sets it's parameter to NULL to help avoid
// mis-referencing.
HRESULT WINAPI ScriptFreeCache(
SCRIPT_CACHE *psc); //InOut Cache handle
///// SCRIPT_CONTROL
//
// The SCRIPT_CONTROL structure provides itemization control flags to the
// ScriptItemize function.
//
//
typedef struct tag_SCRIPT_CONTROL {
DWORD uDefaultLanguage :16; // For NADS, also default for context
DWORD fContextDigits :1; // Means use previous script instead of uDefaultLanguage
// The following flags provide legacy support for GetCharacterPlacement features
DWORD fInvertPreBoundDir :1; // Reading order of virtual item immediately prior to string
DWORD fInvertPostBoundDir :1; // Reading order of virtual item immediately following string
DWORD fLinkStringBefore :1; // Equivalent to presence of ZWJ before string
DWORD fLinkStringAfter :1; // Equivalent to presence of ZWJ after string
DWORD fNeutralOverride :1; // Causes all neutrals to be strong in the current embedding direction
DWORD fNumericOverride :1; // Causes all numerals to be strong in the current embedding direction
DWORD fLegacyBidiClass :1; // Causes plus and minus to be reated as neutrals, slash as a common separator
DWORD fReserved :8;
} SCRIPT_CONTROL;
//
//
//p uDefaultLanguage: Language to use when Unicode values are ambiguous.
// Used by numeric processing to select digit shape when
// fDigitSubstitute (see SCRIPT_STATE) is in force.
//
//p fContextDigits: Specifies that national digits are chosen according to
// the nearest previous strong text, rather than using
// uDefaultLanguage.
//
//p fInvertPreBoundDir: By default text at the start of the string is
// laid out as if it follows strong text of the same direction
// as the base embedding level. Set fInvertPreBoundDir to change
// the initial context to the opposite of the base embedding
// level. This flag is for GetCharacterPlacement legacy support.
//
//p fInvertPostBoundDir: By default text at the end of the string is
// laid out as if it preceeds strong text of the same direction
// as the base embedding level. Set fInvertPostBoundDir to change
// the final context to the opposite of the base embedding
// level. This flag is for GetCharacterPlacement legacy support.
//
//p fLinkStringBefore: Causes the first character of the string to be
// shaped as if were joined to a previous character.
//
//p fLinkStringAfter: Causes the last character of the string to be
// shaped as if were joined to a following character.
//
//p fNeutralOverride: Causes all neutral characters in the string to be
// treated as if they were strong characters of their enclosing
// embedding level. This effectively locks neutrals in place,
// reordering occuring only between neutrals.
//
//p fNumericOverride: Causes all numeric characters in the string to be
// treated as if they were strong characters of their enclosing
// embedding level. This effectively locks numerics in place,
// reordering occuring only between numerics.
//
//p fReserved: Reserved. Always initialise to 0.
///// SCRIPT_STATE
//
// The SCRIPT_STATE structure is used both to initialise the unicode
// algorithm state as an input parameter to ScriptItemize, and is also
// a component of each item analysis returned by ScriptItemize.
//
//
typedef struct tag_SCRIPT_STATE {
WORD uBidiLevel :5; // Unicode Bidi algorithm embedding level (0-16)
WORD fOverrideDirection :1; // Set when in LRO/RLO embedding
WORD fInhibitSymSwap :1; // Set by U+206A (ISS), cleared by U+206B (ASS)
WORD fCharShape :1; // Set by U+206D (AAFS), cleared by U+206C (IAFS)
WORD fDigitSubstitute :1; // Set by U+206E (NADS), cleared by U+206F (NODS)
WORD fInhibitLigate :1; // Equiv !GCP_Ligate, no Unicode control chars yet
WORD fDisplayZWG :1; // Equiv GCP_DisplayZWG, no Unicode control characters yet
WORD fArabicNumContext :1; // For EN->AN Unicode rule
WORD fGcpClusters :1; // For Generating Backward Compatible GCP Clusters (legacy Apps)
WORD fReserved :1;
WORD fEngineReserved :2; // For use by shaping engine
} SCRIPT_STATE;
//
//
//p uBidiLevel: The embedding level associated with all characters in this
// run according to the Unicode bidi algorithm. When passed to
// ScriptItemize, should be initialised to 0 for an LTR base
// embedding level, or 1 for RTL.
//
//p fOverrideDirection: TRUE if this level is an override level (LRO/RLO).
// In an override level, characters are layed out purely
// left to right, or purely right to left. No reordering of digits
// or strong characters of opposing direction takes place.
// Note that this initial value is reset by LRE, RLE, LRO or
// RLO codes in the string.
//
//p fInhibitSymSwap: TRUE if the shaping engine is to bypass mirroring of
// Unicode Mirrored glyphs such as brackets. Set by Unicode
// character ISS, cleared by ASS.
//
//p fCharShape: TRUE if character codes in the Arabic Presentation Forms
// areas of Unicode should be shaped. (Not implemented).
//
//p fDigitSubstitute: TRUE if character codes U+0030 through U+0039
// (European digits) are to be substituted by national digits.
// Set by Unicode NADS, Cleared by NODS.
//
//p fInhibitLigate: TRUE if ligatures are not to be used in the shaping
// of Arabic or Hebrew characters.
//
//p fDisplayZWG: TRUE if control characters are to be shaped as
// representational glyphs. (Normally, control characters are
// shaped to the blank glyph and given a width of zero).
//
//p fArabicNumContext: TRUE indicates prior strong characters were Arabic
// for the purposes of rule P0 on page 3-19 of 'The Unicode
// Standard, version 2.0'. Should normally be set TRUE before
// itemizing an RTL paragraph in an Arabic language, FALSE
// otherwise.
//
//p fGcpClusters: For GetCharaterPlacement legacy support only.
// Initialise to TRUE to request ScriptShape to generate
// the LogClust array the same way as GetCharacterPlacement
// does in Arabic and Hebrew Windows95. Affects only Arabic
// and Hebrew items.
//
//p fReserved: Reserved. Always initialise to 0.
//
//p fEngineReserved: Reserved. Always initialise to 0.
///// SCRIPT_ANALYSIS
//
// Each analysed item is described by a SCRIPT_ANALYSIS structure.
// It also includes a copy of the Unicode algorithm state (SCRIPT_STATE).
//
//
typedef struct tag_SCRIPT_ANALYSIS {
WORD eScript :10; // Shaping engine
WORD fRTL :1; // Rendering direction
WORD fLayoutRTL :1; // Set for GCP classes ARABIC/HEBREW and LOCALNUMBER
WORD fLinkBefore :1; // Implies there was a ZWJ before this item
WORD fLinkAfter :1; // Implies there is a ZWJ following this item.
WORD fLogicalOrder :1; // Set by client as input to ScriptShape/Place
WORD fNoGlyphIndex :1; // Generated by ScriptShape/Place - this item does not use glyph indices
SCRIPT_STATE s;
} SCRIPT_ANALYSIS;
//
//
//p eScript: Opaque value identifying which engine Uniscribe will use to
// Shape, Place and TextOut this item. The value of eScript is
// undefined, and will change in future releases, but attributes
// of eScript may be obtained by calling ScriptGetProperties.
//
//p fRTL: Rendering direction. Normally identical to the parity of the
// Unicode embedding level, but may differ if overridden by
// GetCharacterPlacement legacy support.
//
//p fLayoutRTL: Logical direction - whether conceptually part of a
// left-to-right sequenece or a right-to-left sequence. Although
// this is usually the same as fRTL, for a number in a
// right-to-left run, fRTL is False (because digits are always
// displayed LTR), but fLayoutRTL is True (because the number is
// read as part of the right-to-left sequence).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -