private WordEntry CheckDetailsInitCap(int abbv, CapitalizationType capType, ref string scw, ref SpellCheckResultType resultType, out string root)
            {
                var u8buffer = HunspellTextFunctions.MakeAllSmall(scw, TextInfo);

                scw = HunspellTextFunctions.MakeInitCap(u8buffer, TextInfo);

                resultType |= SpellCheckResultType.OrigCap;
                if (capType == CapitalizationType.Init)
                {
                    resultType |= SpellCheckResultType.InitCap;
                }

                var rv = CheckWord(scw, ref resultType, out root);

                if (capType == CapitalizationType.Init)
                {
                    resultType &= ~SpellCheckResultType.InitCap;
                }

                // forbid bad capitalization
                // (for example, ijs -> Ijs instead of IJs in Dutch)
                // use explicit forms in dic: Ijs/F (F = FORBIDDENWORD flag)

                if (EnumEx.HasFlag(resultType, SpellCheckResultType.Forbidden))
                {
                    rv = null;
                    return(rv);
                }

                if (capType == CapitalizationType.All && rv != null && IsKeepCase(rv))
                {
                    rv = null;
                }

                if (rv != null || (!Affix.CultureUsesDottedI && scw.StartsWith('İ')))
                {
                    return(rv);
                }

                rv = CheckWord(u8buffer, ref resultType, out root);

                if (abbv != 0 && rv == null)
                {
                    u8buffer += ".";
                    rv        = CheckWord(u8buffer, ref resultType, out root);
                    if (rv == null)
                    {
                        u8buffer = scw + ".";
                        if (capType == CapitalizationType.Init)
                        {
                            resultType |= SpellCheckResultType.InitCap;
                        }

                        rv = CheckWord(u8buffer, ref resultType, out root);

                        if (capType == CapitalizationType.Init)
                        {
                            resultType &= ~SpellCheckResultType.InitCap;
                        }

                        if (capType == CapitalizationType.All && rv != null && IsKeepCase(rv))
                        {
                            rv = null;
                        }

                        return(rv);
                    }
                }

                if (
                    rv != null
                    &&
                    IsKeepCase(rv)
                    &&
                    (
                        capType == CapitalizationType.All
                        ||
                        // if CHECKSHARPS: KEEPCASE words with \xDF  are allowed in INITCAP form, too.
                        !(Affix.CheckSharps && u8buffer.Contains('ß'))
                    )
                    )
                {
                    rv = null;
                }

                return(rv);
            }
            private WordEntry CheckDetailsAllCap(int abbv, ref string scw, ref SpellCheckResultType resultType, out string root)
            {
                resultType |= SpellCheckResultType.OrigCap;
                var rv = CheckWord(scw, ref resultType, out root);

                if (rv != null)
                {
                    return(rv);
                }

                if (abbv != 0)
                {
                    rv = CheckWord(scw + ".", ref resultType, out root);
                    if (rv != null)
                    {
                        return(rv);
                    }
                }

                // Spec. prefix handling for Catalan, French, Italian:
                // prefixes separated by apostrophe (SANT'ELIA -> Sant'+Elia).
                var textInfo = TextInfo;
                var apos     = scw.IndexOf('\'');

                if (apos >= 0)
                {
                    scw = HunspellTextFunctions.MakeAllSmall(scw, textInfo);

                    // conversion may result in string with different len than before MakeAllSmall2 so re-scan
                    if (apos < scw.Length - 1)
                    {
                        scw = StringEx.ConcatString(scw, 0, apos + 1, HunspellTextFunctions.MakeInitCap(scw.Subslice(apos + 1), textInfo));
                        rv  = CheckWord(scw, ref resultType, out root);
                        if (rv != null)
                        {
                            return(rv);
                        }

                        scw = HunspellTextFunctions.MakeInitCap(scw, textInfo);
                        rv  = CheckWord(scw, ref resultType, out root);
                        if (rv != null)
                        {
                            return(rv);
                        }
                    }
                }

                if (Affix.CheckSharps && scw.Contains("SS"))
                {
                    scw = HunspellTextFunctions.MakeAllSmall(scw, textInfo);
                    var u8buffer = scw;
                    rv = SpellSharps(ref u8buffer, ref resultType, out root);
                    if (rv == null)
                    {
                        scw = HunspellTextFunctions.MakeInitCap(scw, textInfo);
                        rv  = SpellSharps(ref scw, ref resultType, out root);
                    }

                    if (abbv != 0 && rv == null)
                    {
                        u8buffer += ".";
                        rv        = SpellSharps(ref u8buffer, ref resultType, out root);
                        if (rv == null)
                        {
                            u8buffer = scw + ".";
                            rv       = SpellSharps(ref u8buffer, ref resultType, out root);
                        }
                    }
                }

                return(rv);
            }