コード例 #1
0
        private int EnumFontMethod(
            ref EnumLogFont logFont,
            ref NewTextMetric textMetric,
            uint fontType,
            int lParam)
        {
            // Only interested in TrueType fonts
            if ((fontType & TrueTypeFont) > 0)
            {
                if (lParam == ExtractFamilies)
                {
                    string familyName = logFont.elfLogFont.lfFaceName;
                    if (!families.ContainsKey(familyName))
                    {
                        families.Add(familyName, String.Empty);
                    }
                }
                else if (lParam == ExtractStyles)
                {
                    string styleName = new String(logFont.elfStyle).Trim('\0');
                    if (!styles.Contains(styleName))
                    {
                        styles.AddStyle(styleName);
                    }
                }
                else
                {
                    throw new InvalidOperationException("Unknown EnumFontMethod parameter.");
                }
            }

            return(1);
        }
コード例 #2
0
ファイル: GdiFontEnumerator.cs プロジェクト: nholik/Fo.Net
        private int EnumFontMethod(
            ref EnumLogFont logFont,
            ref NewTextMetric textMetric,
            uint fontType,
            int lParam) {
            // Only interested in TrueType fonts
            if ((fontType & TrueTypeFont) > 0) {
                if (lParam == ExtractFamilies) {
                    string familyName = logFont.elfLogFont.lfFaceName;
                    if (!families.ContainsKey(familyName)) {
                        families.Add(familyName, String.Empty);
                    }
                }
                else if (lParam == ExtractStyles) {
                    string styleName = new String(logFont.elfStyle).Trim('\0');
                    if (!styles.Contains(styleName)) {
                        styles.AddStyle(styleName);
                    }
                }
                else {
                    throw new InvalidOperationException("Unknown EnumFontMethod parameter.");
                }
            }

            return 1;
        }