프로젝트

일반

사용자정보

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

markus / FinalService / KCOM_FinalService / Markus.Fonts / FontDictionary.cs @ c206d293

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

1
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.ttf";
18

    
19
        public const string FONT_VERDANA = "Verdana.ttf";
20

    
21

    
22
        public class MarkusFont
23
        {
24
            public string FileName { get; set; }
25
            public string[] FamilyNames { get; set; }
26
        }
27

    
28
        public static List<MarkusFont> GetMarkusFonts()
29
        {
30
            return new List<MarkusFont>
31
            {
32
                new MarkusFont
33
                {
34
                    FileName = FONT_ARIAL,
35
                    FamilyNames = new [] {"Arial"}
36
                },
37
                 new MarkusFont
38
                {
39
                    FileName = FONT_CALIBRI_BODY,
40
                    FamilyNames = new [] {"Calibri (Body)"}
41
                 },
42
                new MarkusFont
43
                {
44
                    FileName = FONT_VERDANA,
45
                    FamilyNames = new [] {"Verdana"}
46
                },
47
                new MarkusFont
48
                {
49
                    FileName = FONT_TIMES_NEW_ROMAN,
50
                    FamilyNames = new [] { "Times New Roman" }
51
                }
52
            };
53
        }
54

    
55
        public static MarkusFont GetMarkusFont(System.Windows.Media.FontFamily fontFamily)
56
        {
57
            MarkusFont result = new MarkusFont
58
            {
59
                FileName = FONT_ARIAL,
60
                FamilyNames = new[] { "Arial" }
61
            };
62

    
63
            foreach (var item in GetMarkusFonts())
64
            {
65
               if(item.FamilyNames.Contains(fontFamily.Source.Replace("./#", "")))
66
                    //fontFamily.FamilyNames.Select(x => x.Value).Except(item.FamilyNames).Count() > 0)
67
                {
68
                    result = item;
69
                    break;
70
                }
71
            }
72

    
73
            return result;
74
        }
75
    }
76
}
클립보드 이미지 추가 (최대 크기: 500 MB)