From a29b1de55abca2e90733caff7423e5251d72e03c Mon Sep 17 00:00:00 2001 From: Nathan Willis Date: Sat, 11 May 2019 20:56:55 +0100 Subject: [PATCH] Usermanual, fix up userfeatures example code in OpenType features section of shaping chapter. --- docs/usermanual-opentype-features.xml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/usermanual-opentype-features.xml b/docs/usermanual-opentype-features.xml index 4405328bf..242ac8e1f 100644 --- a/docs/usermanual-opentype-features.xml +++ b/docs/usermanual-opentype-features.xml @@ -167,13 +167,20 @@ "discretionary" ligatures in the font: - unsigned int num_features = 1; - hb_feature_t userfeatures[num_features]; + hb_feature_t userfeatures[1]; userfeatures[0].tag = HB_TAG('d','l','i','g'); userfeatures[0].value = 1; - userfeatures[0].start = 0; - userfeatures[0].end = (unsigned int) -1; + userfeatures[0].start = HB_FEATURE_GLOBAL_START; + userfeatures[0].end = HB_FEATURE_GLOBAL_END; + + HB_FEATURE_GLOBAL_END and + HB_FEATURE_GLOBAL_END are macros we can use + to indicate that the features will be applied to the entire + buffer. We could also have used a literal 0 + for the start and a -1 to indicate the end of + the buffer (or have selected other start and end positions, if needed). + When we pass the userfeatures array to hb_shape(), any discretionary ligature