📄 usp10.h
字号:
// whether left to right, or right to left.
//
// ScriptShape may set the fNoGlyphIndex flag in psa if the font or
// OS cannot support glyph indices.
//
// If fLogicalOrder is requested in psa, glyphs will be always be
// generated in the same order as the original Unicode characters.
//
// If fLogicalOrder is not set, right to left items are generated in
// reverse order, so ScriptTextOut does not need to reverse them before
// calling ExtTextOut.
///// ScriptPlace
//
// The ScriptPlace function takes the output of a ScriptShape call and
// generates glyph advance width and 2D offset information.
//
// The composite ABC width for the whole item identifies how much the
// glyphs overhang to the left of the start position and to the right of
// the length implied by the sum of the advance widths.
//
// The total advance width of the line is exactly abcA + abcB + abcC.
//
// abcA and abcC are maintained internally by Uniscribe as proportions
// of the cell height represented in 8 bits and are thus roughly +/- 1%.
// The total width returned (as the sum of piAdvance, and as the sum of
// abcA+abcB+abcC) is accurate to the resolution of the TrueType shaping
// engine.
//
// All glyph related arrays are in visual order unless the fLogicalOrder
// flag is set in psa.
#ifndef LSDEFS_DEFINED
typedef struct tagGOFFSET {
LONG du;
LONG dv;
} GOFFSET;
#endif
HRESULT WINAPI ScriptPlace(
HDC hdc, // In Optional (see under caching)
SCRIPT_CACHE *psc, // InOut Cache handle
const WORD *pwGlyphs, // In Glyph buffer from prior ScriptShape call
int cGlyphs, // In Number of glyphs
const SCRIPT_VISATTR *psva, // In Visual glyph attributes
SCRIPT_ANALYSIS *psa, // InOut Result of ScriptItemize (may have fNoGlyphIndex set)
int *piAdvance, // Out Advance wdiths
GOFFSET *pGoffset, // Out x,y offset for combining glyph
ABC *pABC); // Out Composite ABC for the whole run (Optional)
///// ScriptTextOut
//
// The ScriptTextOut function takes the output of both ScriptShape and
// ScriptPlace calls and calls the operating system ExtTextOut function
// appropriately.
//
// All arrays are in visual order unless the fLogicalOrder flag is set in
// psa.
HRESULT WINAPI ScriptTextOut(
const HDC hdc, // In OS handle to device context (required)
SCRIPT_CACHE *psc, // InOut Cache handle
int x, // In x,y position for first glyph
int y, // In
UINT fuOptions, // In ExtTextOut options
const RECT *lprc, // In optional clipping/opaquing rectangle
const SCRIPT_ANALYSIS *psa, // In Result of ScriptItemize
const WCHAR *pwcReserved,// In Reserved (requires NULL)
int iReserved, // In Reserved (requires 0)
const WORD *pwGlyphs, // In Glyph buffer from prior ScriptShape call
int cGlyphs, // In Number of glyphs
const int *piAdvance, // In Advance widths from ScriptPlace
const int *piJustify, // In Justified advance widths (optional)
const GOFFSET *pGoffset); // In x,y offset for combining glyph
/////
//
// The caller should normally use SetTextAlign(hdc, TA_RIGHT) before
// calling ScriptTextOut with an RTL item inlogical order.
//
// The piJustify array provides requested cell widths for each glyph.
// When the piJustify width of a glyph differs from the unjustified
// width (in PiAdvance), space is added to or removed from the glyph
// cell at it's trailing edge. The glyph is always aligned with the
// leading edge of it's cell. (This rule applies even in visual order.)
//
// When a glyph cell is extended the extra space is uaually made up by
// the addition of white space, however for Arabic scripts, the extra
// space is made up by one or more kashida glyphs, unless the extra space
// is insufficient for the shortest kashida glyph in the font. (The
// width of the shortest kashida is available by calling
// ScriptGetFontProperties.)
//
// piJustify should only be passed if re-justification of the string is
// required. Normally pass NULL to this parameter.
//
// fuOptions may contain ETO_CLIPPED or ETO_OPAQUE (or neither or both).
//
// Do not use ScriptTextOut to write to a metafile unless you are sure
// that the metafile will eventually be played back without any font
// substitution. ScriptTextOut record glyph numbers in the metafile.
// Since glyph numbers vary considerably from one font to another
// such a metafile is unlikely to play back correctly when differant
// fonts are substituted.
//
// For example when a metafile is played back at a different scale
// CreateFont requests recorded in the metafile may resolve to bitmap
// instead of truetype fonts, or if the metafile is played back on
// a different machine requested fonts may not be installed.//
//
// To write complex scripts in a metafile in a font independant manner,
// use ExtTextOut to write the logical characters directly, so that
// glyph generation and placement does not occur until the text is
// played back.
///// ScriptJustify
//
// ScriptJustify provides a simple minded implementation of multilingual
// justification.
//
// Sophisticated text formatters may prefer to generate their own delta
// dx array by combining their own features with the information returned
// by ScriptShape in the SCRIPT_VISATTR array.
//
// ScriptJustify establishes how much adjustment to make at each glyph
// position on the line. It interprets the SCRIPT_VISATTR array generated
// by a call to ScriptShape, and gives top priority to kashida, then uses
// inter word spacing if there's no kashida points, then uses
// intercharacter spacing if there are no inter-word points.
//
// The justified advance widths generated in ScriptJustify should be
// passed to ScriptTextOut in the piJustify paramter.
//
// ScriptJustify creates a justify array containing updated advance
// widths for each glyph. Where a glyphs advance width is increased, it
// is expected that the extra width will be rendered to the right of the
// glyph, with as white space or, for Arabic text, as kashida.
/////
HRESULT WINAPI ScriptJustify(
const SCRIPT_VISATTR *psva, // In Collected visual attributes for entire line
const int *piAdvance, // In Advance widths from ScriptPlace
int cGlyphs, // In Size of all arrays
int iDx, // In Desired width change, either increase or descrease
int iMinKashida, // In Minimum length of continuous kashida glyph to generate
int *piJustify); // Out Updated advance widths to pass to ScriptTextOut
///// SCRIPT_LOGATTR
//
// The SCRIPT_LOGATTR structure describes attributes of logical
// characters useful when editing and formatting text.
//
// Note that for wordbreaking and linebreaking, if the first character of
// the run passed in is not whitespace, the client needs to check whether
// the last character of the previous run is whitespace to determine if
// the first character of this run is the start of a word.
//
//
typedef struct tag_SCRIPT_LOGATTR {
BYTE fSoftBreak :1; // Potential linebreak point
BYTE fWhiteSpace :1; // A unicode whitespace character, except NBSP, ZWNBSP
BYTE fCharStop :1; // Valid cursor position (for left/right arrow)
BYTE fWordStop :1; // Valid cursor position (for ctrl + left/right arrow)
BYTE fInvalid :1; // Invalid character sequence
BYTE fReserved :3;
} SCRIPT_LOGATTR;
//
//
//p fSoftBreak: It would be valid to break the line in front of this
// character. This flag is set on the first character of
// South-East Asian words. Note that when linebreaking the
// client would usually also treat any nonblank following a blank
// as a softbreak position, by inspecting the fWhiteSPace flag
// below.
//
//p fWhiteSpace: This character is one of the many Unicode character
// that are classified as breakable whitespace.
//
//p fCharStop: Valid cursor position. Set on most characters, but not
// on codepoints inside Indian and South East Asian character
// clusters. May be used to implement left and right arrow
// operation in editors.
//
//p fWordStop: Valid position following word advance/retire commonly
// implemented at ctrl/left-arrow and ctrl/right-arrow.
// May be used to implement ctrl+left and ctrl+right arrow
// operation in editors. As with fSoftBreak clients should
// normally also inspect the fWhiteSpace flag and treat the
// first character after a run of whitespace as the start of a
// word.
//
//p fInvalid: Marks characters which form an invalid or undisplayable
// combination. Scripts which can set this flag have the flag
// fInvalidLogAttr set in their SCRIPT_PROPERTIES.
///// ScriptBreak
//
// The ScriptBreak function returns cursor movement and formatting break
// positions for an item as an array of SCRIPT_LOGATTRs. To support
// mixed formatting within a single word correctly, ScriptBreak should
// be passed whole items as returned by ScriptItemize.
//
// ScriptBreak does not require an hdc and does not execute glyph shaping.
//
// The fCharStop flag marks cluster boundaries for those scripts where
// it is conventional to restrict from moving inside clusters. The same
// boundaries could also be inferred by inspecting the pLogCLust array
// returned by ScriptShape, however ScriptBreak is considerably faster in
// implementation and does not require an hdc to be prepared.
//
// The fWordStop, fSoftBreak and fWhiteSpace flags are only available
// through ScriptBreak.
//
// Most shaping engines that identify invalid sequences do so by setting
// the fInvalid flag in ScriptBreak. The fInvalidLogAttr flag in
// ScriptProperties identifies which scripts do this.
HRESULT WINAPI ScriptBreak(
const WCHAR *pwcChars, // In Logical unicode item
int cChars, // In Length of unicode item
const SCRIPT_ANALYSIS *psa, // In Result of earlier ScriptItemize call
SCRIPT_LOGATTR *psla); // Out Logical character attributes
///// ScriptCPtoX
//
// The ScriptCPtoX function returns the x offset from the left end
// (!fLogical) or leading edge (fLogical) of a run to either the leading
// or the trailing edge of a logical character cluster.
//
// iCP is the offset of any logical character in the cluster.
//
// For scripts where the caret may conventionally be placed into the
// middle of clusters (e.g. Arabic, Hebrew), the returned X may be
// an interpolated position for any codepoint in the line.
//
// For scripts where the caret is conventionally snapped to the boundaries
// of clusters, (e.g. Thai, Indian), the resulting X position will be
// snapped to the requested edge of the cluster containing CP.
HRESULT WINAPI ScriptCPtoX(
int iCP, // In Logical character position in run
BOOL fTrailing, // In Which edge (default - leading)
int cChars, // In Count of logical codepoints in run
int cGlyphs, // In Count of glyphs in run
const WORD *pwLogClust, // In Logical clusters
const SCRIPT_VISATTR *psva, // In Visual glyph attributes array
const int *piAdvance, // In Advance widths
const SCRIPT_ANALYSIS *psa, // In Script analysis from item attributes
int *piX); // Out Resulting X position
///// ScriptXtoCP
//
// The ScriptXtoCP function converts an x offset from the left end
// (!fLogical) or leading edge (fLogical) of a run to a logical
// character position and a flag that indicates whether the X position
// fell in the leading or the trailing half of the character.
//
// For scripts where the cursor may conventionally be placed into the
// middle of clusters (e.g. Arabic, Hebrew), the returned CP may be
// for any codepoint in the line, and fTrailing will be either zero
// or one.
//
// For scripts where the cursor is conventionally snapped to the
// boundaries of a cluster, the returned CP is always the position of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -