Placeholder for vendor code to adapt vendor hyphenation to the linguistic API. A dummy implementation is provided that creates two regular hyphenation points, one at the index given by parameter nMinHead and the other at the index given by the word length - parameter nMinTail. For example if Hyphenate were called like this for the word elizabeth: Hyphenate("elizabeth", 3, 3, ...
hyphenation points would be created that could result in the word being hyphenated as eli-zab-eth. The implementation also respects and creates hyphenation points for discretionary hyphens or hard coded hyphens passed in the word.
Notes:
To convert the Unicode text to ASCII before presenting a word to an ASCII hyphenator check out HypAdapter::textCharToChar.
Converting Unicode to a PMString then using PMString::GetPlatformString().c_str() to get ASCII is likely to lead to bugs. Unicode character codes that have no ASCII equivalent appear encoded in the string returned by GetPlatformString().c_str.
The following characters may be presented as part of the word to be hyphenated if they are not preceeded or followed by a word break character. If such characters must be stripped from the word before presenting it to a hyphenator re-adjust the hyphenation points so they are relative to the word passed by the application: kTextChar_FlushSpace kTextChar_EnSpace kTextChar_EmSpace kTextChar_FigureSpace kTextChar_PunctuationSpace kTextChar_ThinSpace kTextChar_HairSpace kTextChar_HardSpace kTextChar_ZeroSpaceBreak kTextChar_ZeroSpaceNoBreak kTextChar_EnDash kTextChar_EmDash kTextChar_Ellipse kTextChar_UnicodeHyphen kTextChar_NoBreakHyphen kTextChar_FigureDash kTextChar_HorizontalBar kTextChar_LeftDoubleQuotationMark kTextChar_RightDoubleQuotationMark kTextChar_DoubleLow9QuotationMark kTextChar_DoubleHighReversed9QuotationMark kTextChar_LeftDblAngQuote kTextChar_RightDblAngQuote kTextChar_LeftSingleQuotationMark kTextChar_RightSingleQuotationMark kTextChar_SingleLow9QuotationMark kTextChar_SingleHighReversed9QuotationMark
| IHyphenatedWord * HypAdapter::Hyphenate | ( | const TextCharBuffer & | rWord, | | | uint16 | nMinTail, | | | uint16 | nMinHead, | | | const LinguisticServiceMode & | serviceMode, | | | const LanguageID & | languageID | | ) | | |
| virtual |
Hypenate the given word. Parameters nMinHead and nMinTail specify the range of indexes in the word where hyphen breaks are permitted. For example, by specifying 3 for these values, the word kitten could be hyphenated kit-ten. i.e.
kit-ten
0 1 2 3 4 5
k i t t e n
0 0 1 0 0 0 (where 1 indicates valid hyphen index)
A hyphen index is the position before the hyphen: i.e. kit-ten has a hyphen index = 2.
Given i is a valid hyphen index it will lie in this range:
nMinHead: i >=(nMinHead - 1) for nMinHead = 3, first i would be 2 (>= 3-1)
nMinTail: i < (wordLength - nMinTail) for nMinTail = 3, last i would be 2 (< 6-3)
- Parameters
| rWord | to be hyphenated. |
| nMinTail | the minimum number of characters at the end of a word after a hyphen. |
| nMinHead | the minimum number of characters at the start of a word before a hyphen. |
| serviceMode | is the type of hyphenation desired (algorithmic, dictionary, see LinguisticID.h). The value passed is controlled by text attribute kTextAttrHyphenModeBoss. |
| languageID | the language of the word (see LanguageID.h). |
- Returns
- hypenated word (see HypHyphenatedWord).