프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / FinalServiceV3 / KCOM_FinalService / Markus.Fonts / FontDictionary.cs @ faf998c6

이력 | 보기 | 이력해설 | 다운로드 (2.86 KB)

1 faf998c6 taeseongkim
using System;
2
using System.Collections.Generic;
3
using System.IO;
4
using System.Linq;
5
using System.Reflection;
6
using System.Text;
7
using System.Threading.Tasks;
8
9
namespace Markus.Fonts
10
{
11
    public static class FontDictionary
12
    {
13
        public const string FONT_ARIAL = "NanumGothic.ttf";
14
15
        public const string FONT_CALIBRI_BODY = "NanumSquareRoundR.ttf";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
16
17
        public const string FONT_TIMES_NEW_ROMAN = "NanumMyeongjo-Regular.ttf";
18
19
        public const string FONT_VERDANA = "Verdana.ttf";
20
21
        public static List<MarkusFont> GetMarkusFonts()
22
        {
23
            return new List<MarkusFont>
24
            {
25
                new MarkusFont
26
                {
27
                    ResourceName = FONT_ARIAL,
28
                    FamilyNames = new [] {"Arial"},
29
                    IsDefault = true
30
                },
31
                 new MarkusFont
32
                {
33
                    ResourceName = FONT_CALIBRI_BODY,
34
                    FamilyNames = new [] {"Calibri (Body)"}
35
                 },
36
                new MarkusFont
37
                {
38
                    ResourceName = FONT_VERDANA,
39
                    FamilyNames = new [] {"Verdana"}
40
                },
41
                new MarkusFont
42
                {
43
                    ResourceName = FONT_TIMES_NEW_ROMAN,
44
                    FamilyNames = new [] { "Times New Roman" }
45
                }
46
            };
47
        }
48
49
        public static MarkusFont GetMarkusFont(System.Windows.Media.FontFamily fontFamily)
50
        {
51
            MarkusFont result = new MarkusFont
52
            {
53
                ResourceName = FONT_ARIAL,
54
                FamilyNames = new[] { "Arial" }
55
            };
56
57
            foreach (var item in GetMarkusFonts())
58
            {
59
               if(item.FamilyNames.Contains(fontFamily.Source.Replace("./#", "")))
60
                    //fontFamily.FamilyNames.Select(x => x.Value).Except(item.FamilyNames).Count() > 0)
61
                {
62
                    result = item;
63
                    break;
64
                }
65
            }
66
67
            return result;
68
        }
69
    }
70
}
클립보드 이미지 추가 (최대 크기: 500 MB)