Download FDK Programmer`s Reference

Transcript
F_ApiSetTextPropVal()
...
FDK Reference
Example
The following code sets the size of the selected text to 30 points and sets the underlining
to a single underline:
. . .
#define pts (MetricT) 65536 /* A Frame metric point. */
F_TextRangeT tr;
F_PropValsT props;
F_ObjHandleT docId;
/* Get current text selection. */
docId = F_ApiGetId(0, FV_SessionId, FP_ActiveDoc);
tr = F_ApiGetTextRange(FV_SessionId, docId, FP_TextSelection);
if (tr.beg.objId == 0) return;
/* Allocate memory for the list. */
props = F_ApiAllocatePropVals(2);
/* Set up the properties. */
props.val[0].propIdent.num = FP_FontSize;
props.val[0].propVal.valType = FT_Metric;
props.val[0].propVal.u.ival = 30 * pts;
props.val[1].propIdent.num = FP_Underlining;
props.val[1].propVal.valType = FT_Integer;
props.val[1].propVal.u.ival = FV_CS_SINGLE_UNDERLINE;
/* Apply the property list to the text selection. */
F_ApiSetTextProps(docId, &tr, &props);
/* Deallocate memory referenced by the property list. */
F_ApiDeallocatePropVals(&props);
. . .
See also
“F_ApiGetTextProps()” on page 265.
F_ApiSetTe xtPropVal()
F_ApiSetTextPropVal() sets a text property for a specified text range. The
property can be of any type.
FDK Programmer’s Reference 447