Пример #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
        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;
        }