📄 usp10.h
字号:
//
//p fLinkBefore: If set, the shaping engine will shape the first character
// of this item as if it were joining with a previous character.
// Set by ScriptItemize, may be overriden before calling ScriptShape.
//
//p fLinkAfter: If set, the shaping engine will shape the last character
// of this item as if it were joining with a subsequient character.
// Set by ScriptItemize, may be overriden before calling ScriptShape.
//
//p fLogicalOrder: If set, the shaping engine will generate all glyph
// related arrays in logical order. By default glyph related
// arrays are in visual order, the first array entry corresponding
// to the leftmost glyph.
// Set to FALSE by ScriptItemize, may be overriden before calling
// ScriptShape.
//
//p fNoGlyphIndex: May be set TRUE on input to ScriptShape to disable use
// of glyphs for this item. Additionally, ScriptShape will set it
// TRUE for hdcs containing symbolic, unrecognised and device fonts.
// Disabling glyphing disables complex script shaping. When set,
// shaping and placing for this item is implemented directly by
// calls to GetTextExtentExPoint and ExtTextOut.
///// SCRIPT_ITEM
//
// The SCRIPT_ITEM structure includes a SCRIPT_ANALYSIS with the string
// ofset of the first character of the item.
//
//
typedef struct tag_SCRIPT_ITEM {
int iCharPos; // Logical offset to first character in this item
SCRIPT_ANALYSIS a;
} SCRIPT_ITEM;
//
//
//p iCharPos: Offset from beginning of itemised string to first character
// of this item, counted in Unicode codepoints (i.e. words).
//
//p a: Script analysis structure containing analysis specific to this
// item, to be passed to ScriptShape, ScriptPlace etc.
///// ScriptItemize - break text into items
//
// Breaks a run of unicode into individually shapeable items.
// Items are delimited by
//
// o Change of shaping engine
// o Change of direction
//
// The client may create multiple runs from each item returned by
// ScriptItemize, but should not combine multiple items into a single run.
//
// Later the client will call ScriptShape for each run (when measuring or
// rendering), and must pass the SCRIPT_ANALYSIS that ScriptItemize
// returned.
HRESULT WINAPI ScriptItemize(
const WCHAR *pwcInChars, // In Unicode string to be itemized
int cInChars, // In Codepoint count to itemize
int cMaxItems, // In Max length of itemization array
const SCRIPT_CONTROL *psControl, // In Analysis control (optional)
const SCRIPT_STATE *psState, // In Initial bidi algorithm state (optional)
SCRIPT_ITEM *pItems, // Out Array to receive itemization
int *pcItems); // Out Count of items processed (optional)
/////
//
//
// Returns E_INVALIDARG if pwcInChars == NULL or cInChars == 0
// or pItems == NULL or cMaxItems < 2.
//
// Returns E_OUTOFMEMORY if the output buffer length (cMaxItems) is
// insufficient. Note that in this case, as in all error cases, no
// items have been fully processed so no part of the output array
// contains defined values.
//
// If psControl and psState are NULL on entry, ScriptItemize
// breaks the unicode string purely by character code. If they are all
// non-null, it performs a full Unicode bidi analysis.
//
// ScriptItemize always adds a terminal item to the item analysis array
// (pItems) such that the length of an item at pItem is always available as:
//
//c pItem[1].iCharPos - pItem[0].iCharPos
//
// For this reason, it is invalid to call ScriptItemize with a buffer
// of less than two SCRIPT_ANALYSIS items.
//
// To perform a correct Unicode Bidi analysis, the SCRIPT_STATE should
// be initialised according to the paragraph reading order at paragraph
// start, and ScriptItemize should be passed the whole paragraph.
//
// fRTL and fNumeric together provide the same classification as
// the lpClass output from GetCharacterPlacement.
//
// European digits U+0030 through U+0039 may be rendered as national
// digits as follows:
//
//t fDigitSubstitute | FContextDigits | Digit shapes displayed for Unicode U+0030 through U+0039
//t ---------------- | -------------- | ------------------------------------
//t False | Any | Western (European / American) digits
//t True | False | As specified in SCRIPT_CONTROL.uDefaultLanguage
//t True | True | As prior strong text, defaulting to SCRIPT_CONTROL.uDefaultLanguage
//
//
// For fContextDigits, any Western digits (U+0030 - U+0039) encountered
// before the first strongly directed character are substituted by the
// traditional digits of the SCRIPT_CONTROL.uDefaultLanguage when that
// language is written in the same direction as SCRIPT_STATE.uBidiLevel.
//
// Thus, in a right-to-left string, if SCRIPT_CONTROL.uDefaultLanguage is
// 1 (LANG_ARABIC), then leading Western digits will be substituted by
// traditional Arabic digits.
//
// However, also in a right-to-left string, if SCRIPT_CONTROL.uDefaultLanguage
// is 0x1e (LANG_THAI), then no substitution occurs on leading Western
// digits because the Thai language is written left-to-right.
//
// Following strongly directed characters, digits are substituted
// by the traditional digits associated with the closest prior strongly
// directed character.
//
// The left-to-right mark (LRM) and right-to-left mark (RLM) are strong
// characters whose language depends on the SCRIPT_CONTROL.uDefaultLangauge.
//
// If SCRIPT_CONTROL.uDefaultLangauge is a left-to-right langauge, then
// LRM causes subsequent Western digits to be substituted by the
// traditional digits associated with that language, while Western
// digits following RLM are not substituted.
//
// Conversly, if SCRIPT_CONTROL.uDefaultLangauge is a right-to-left
// langauge, then Western digits following LRM are not substituted, while
// Western digits following RLM are substituted by the traditional digits
// associated with that language.
//
//
//
// Effect of Unicode control characters on SCRIPT_STATE:
//
//t SCRIPT_STATE flag | Set by | Cleared by
//t ----------------- | ------ ----------
//t fDigitSubstitute | NADS | NODS
//t fInhibitSymSwap | ISS | ASS
//t fCharShape | AAFS | IAFS
//
// SCRIPT_STATE.fArabicNumContext controls the Unicode EN->AN rule.
// It should normally be initialised to TRUE
// before itemizing an RTL paragraph in an Arabic language, FALSE
// otherwise.
///// ScriptLayout
//
// The ScriptLayout function converts an array of run embedding levels to
// a map of visual to logical position, and/or logical to visual position.
//
// pbLevel must contain the embedding levels for all runs on the line,
// ordered logically.
//
// On output, piVisualToLogical[0] is the logical index of the run to
// display at the far left. Subsequent entries should be displayed
// progressing from left to right.
//
// piLogicalToVisual[0] is the relative visual position where the first
// logical run should be displayed - the leftmost display position being zero.
//
// The caller may request either piLogicalToVisual or piVisualToLogical
// or both.
//
// Note: No other input is required since the embedding levels give all
// necessary information for layout.
HRESULT WINAPI ScriptLayout(
int cRuns, // In Number of runs to process
const BYTE *pbLevel, // In Array of run embedding levels
int *piVisualToLogical, // Out List of run indices in visual order
int *piLogicalToVisual); // Out List of visual run positions
///// SCRIPT_JUSTIFY
//
// The script justification enumeration provides the client with the
// glyph characteristic information it needs to implement justification.
typedef enum tag_SCRIPT_JUSTIFY {
SCRIPT_JUSTIFY_NONE = 0, // Justification can't be applied at this glyph
SCRIPT_JUSTIFY_ARABIC_BLANK = 1, // This glyph represents a blank in an Arabic run
SCRIPT_JUSTIFY_CHARACTER = 2, // Inter-character justification point follows this glyph
SCRIPT_JUSTIFY_RESERVED1 = 3, // Reserved #1
SCRIPT_JUSTIFY_BLANK = 4, // This glyph represents a blank outside an Arabic run
SCRIPT_JUSTIFY_RESERVED2 = 5, // Reserved #2
SCRIPT_JUSTIFY_RESERVED3 = 6, // Reserved #3
SCRIPT_JUSTIFY_ARABIC_NORMAL = 7, // Normal Middle-Of-Word glyph that connects to the right (begin)
SCRIPT_JUSTIFY_ARABIC_KASHIDA = 8, // Kashida(U+640) in middle of word
SCRIPT_JUSTIFY_ARABIC_ALEF = 9, // Final form of Alef-like (U+627, U+625, U+623, U+632)
SCRIPT_JUSTIFY_ARABIC_HA = 10, // Final form of Ha (U+647)
SCRIPT_JUSTIFY_ARABIC_RA = 11, // Final form of Ra (U+631)
SCRIPT_JUSTIFY_ARABIC_BA = 12, // Middle-Of-Word form of Ba (U+628)
SCRIPT_JUSTIFY_ARABIC_BARA = 13, // Ligature of alike (U+628,U+631)
SCRIPT_JUSTIFY_ARABIC_SEEN = 14, // Highest priority: Initial shape of Seen(U+633) (end)
SCRIPT_JUSTIFY_RESERVED4 = 15, // Reserved #4
} SCRIPT_JUSTIFY;
///// SCRIPT_VISATTR
//
// The visual (glyph) attribute buffer generated by ScriptShape
// identifies clusters and justification points:
typedef struct tag_SCRIPT_VISATTR {
WORD uJustification :4; // Justification class
WORD fClusterStart :1; // First glyph of representation of cluster
WORD fDiacritic :1; // Diacritic
WORD fZeroWidth :1; // Blank, ZWJ, ZWNJ etc, with no width
WORD fReserved :1; // General reserved
WORD fShapeReserved :8; // Reserved for use by shaping engines
} SCRIPT_VISATTR;
//
//
//p uJustification: Justification class for this glyph. See SCRIPT_JUSTIFY.
//
//p fClusterStart: Set for the logically first glyph in every cluster,
// even for clusters containing just one glyph.
//
//p fDiacritic: Set for glyphs that combine with base characters.
//
//p fZeroWidth: Set by the shaping engine for some, but not all, zero
// width characters.
///// ScriptShape
//
// The ScriptShape function takes a Unicode run and generates glyphs and
// visual attributes.
//
// The number of glyphs generated varies according to the script and the
// font. Only for simple scripts and fonts does each Unicode code point
// generates a single glyph.
//
// There is no limit on the number of glyphs generated by a codepoint.
// For example, a sophisticated complex script font might choose to
// constuct characters from components, and so generate many times as
// many glyphs as characters.
//
// There are also special cases like invalid character representations,
// where extra glyphs are added to represent the invalid sequence.
//
// A reasonable guess might be to provide a glyph buffer 1.5 times the
// length of the character buffer, plus a 16 glyph fixed addition for
// rare cases like invalid sequenece representation.
//
// If ScriptShape returns E_OUTOFMEMORY it will be necessary to recall
// it, possibly more than once, until a large enough buffer is found.
HRESULT WINAPI ScriptShape(
HDC hdc, // In Optional (see under caching)
SCRIPT_CACHE *psc, // InOut Cache handle
const WCHAR *pwcChars, // In Logical unicode run
int cChars, // In Length of unicode run
int cMaxGlyphs, // In Max glyphs to generate
SCRIPT_ANALYSIS *psa, // InOut Result of ScriptItemize (may have fNoGlyphIndex set)
WORD *pwOutGlyphs, // Out Output glyph buffer
WORD *pwLogClust, // Out Logical clusters
SCRIPT_VISATTR *psva, // Out Visual glyph attributes
int *pcGlyphs); // Out Count of glyphs generated
/////
//
// Returns E_OUTOFMEMORY if the output buffer length (cMaxGlyphs) is
// insufficient. Note that in this case, as in all error cases, the
// content of the output array is undefined.
//
// Clusters are sequenced uniformly within the run, as are glyphs within
// the cluster - the fRTL item flag (from ScriptItemize) identifies
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -