첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

■ GlyphRunDrawing 엘리먼트의 GlyphRun 속성을 사용해 텍스트를 그리는 방법을 보여준다.

TestProject.zip
0.01MB

▶ MainWindow.xaml

<Window x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800"
    Height="600"
    Title="TestProject"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Rectangle
        Width="500"
        Height="100">
        <Rectangle.Fill>
            <DrawingBrush>
                <DrawingBrush.Drawing>
                    <GlyphRunDrawing ForegroundBrush="Black">
                        <GlyphRunDrawing.GlyphRun>
                            <GlyphRun
                                CaretStops="{x:Null}"
                                ClusterMap="{x:Null}"
                                IsSideways="False"
                                GlyphOffsets="{x:Null}"
                                GlyphIndices="43 72 79 79 82 3 58 82 85 79 71"
                                BaselineOrigin="0 12.29"
                                FontRenderingEmSize="13.333333333333334"
                                DeviceFontName="{x:Null}"
                                AdvanceWidths="9.62666666666667 7.41333333333333 2.96 2.96 7.41333333333333 3.70666666666667 12.5866666666667 7.41333333333333 4.44 2.96 7.41333333333333"
                                BidiLevel="0">
                                <GlyphRun.GlyphTypeface>
                                    <GlyphTypeface FontUri="C:\WINDOWS\Fonts\TIMES.TTF" />
                                </GlyphRun.GlyphTypeface>
                            </GlyphRun>
                        </GlyphRunDrawing.GlyphRun>
                    </GlyphRunDrawing>
                </DrawingBrush.Drawing>
            </DrawingBrush>
        </Rectangle.Fill>
    </Rectangle>
</Window>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요