@@ -2991,7 +2991,84 @@ given font families in the 'font-family!!property' list
2991
2991
<h3 id="cluster-matching">
2992
2992
Cluster matching</h3>
2993
2993
2994
- Issue: Import from level 3
2994
+
2995
+ When text contains characters such as combining marks,
2996
+ ideally
2997
+ the base character should be rendered
2998
+ using the same font as the mark,
2999
+ this assures proper placement of the mark.
3000
+ For this reason,
3001
+ the font matching algorithm for clusters
3002
+ is more specialized
3003
+ than the general case of matching a single character by itself.
3004
+ For sequences containing variation selectors,
3005
+ which indicate the precise glyph to be used for a given character,
3006
+ user agents always attempt <a>system font fallback</a>
3007
+ to find the appropriate glyph
3008
+ before using the default glyph of the base character.
3009
+
3010
+ A sequence of codepoints containing combining mark
3011
+ or other modifiers
3012
+ is termed a grapheme cluster
3013
+ (see [[CSS3TEXT]] and [[UAX29]] for a more complete description).
3014
+ For a given cluster containing a base character,
3015
+ <em> b</em> and a sequence of combining characters
3016
+ <em> c1, c2…</em> , the entire cluster is matched using these steps:</p>
3017
+
3018
+ <ol>
3019
+
3020
+ <li> For each family in the font list,
3021
+ a face is chosen using the style selection rules
3022
+ defined in the previous section.
3023
+ <ol>
3024
+
3025
+ <li> If all characters in the sequence <em> b + c1 + c2 …</em>
3026
+ are completely supported by the font,
3027
+ select this font for the sequence.</li>
3028
+
3029
+ <li> If a sequence of multiple codepoints
3030
+ is canonically equivalent to a single character
3031
+ and the font <a>supports</a> that character,
3032
+ select this font for the sequence
3033
+ and use the glyph associated with
3034
+ the canonically equiavlent character
3035
+ for the entire cluster.</li>
3036
+
3037
+ </ol>
3038
+
3039
+ <li> If no font was found in the font list in step 1:
3040
+
3041
+ <ol>
3042
+
3043
+ <li> If <em> c1</em> is a variation selector,
3044
+ system fallback must be used
3045
+ to find a font that <em title="support"> supports</em>
3046
+ the full sequence of <em> b + c1</em> .
3047
+ If no font on the system <a>supports</a> the full sequence,
3048
+ match the single character <em> b</em>
3049
+ using the normal procedure for matching
3050
+ single characters
3051
+ and ignore the variation selector.
3052
+ Note: a sequence with more than one variation selector
3053
+ must be treated as an encoding error
3054
+ and the trailing selectors must be ignored. [[!UNICODE]] </li>
3055
+
3056
+ <li> Otherwise, the user agent may optionally use
3057
+ system font fallback
3058
+ to match a font that <a>supports</a>
3059
+ the entire cluster.</li>
3060
+
3061
+ </ol>
3062
+
3063
+ <li> If no font is found in step 2,
3064
+ use the matching sequence
3065
+ from step 1 to determine the longest sequence
3066
+ that is completely <a>supported</a>
3067
+ by a font in the font list
3068
+ and attempt to match the remaining combining characters
3069
+ separately using the rules for single characters.</li>
3070
+
3071
+ </ol>
2995
3072
2996
3073
<h3 id="char-handling-issues">
2997
3074
Character handling issues</h3>
0 commit comments