티스토리 뷰

728x90
반응형

MicroChart label 텍스트가 기기 내장 폰트로만 적용되기에 한글이 깨지는 현상이 있음.

iOS는 'Apple SD Gothic Neo' 폰트로 사용하면되고,
Android는 내장 기본폰트가 모두 깨지기에 Embeded된 font를 사용하여 한글 폰트 적용
SKFontManager.Default.MatchCharacter('가') 로 MatchCharacter를 적용했지만
한글은 정상출력 되었으나 Value값이 깨짐 한글, 영문, 숫자 모두 출력을 위해 외부 폰트를 적용하는것으로 결론.

Android MicroChart 한글폰트적용
1. Xamairn.Andriod Assets 폴더에 한글 폰트 복사
2. 네이버 NanumBarunGothic.ttf 폰트를 사용했음
3. SKTypeface에서 아래 GetSkiaTypefaceFromAssetFont() 적용


private SKTypeface TypeFaceFor;
protected override void OnAppearing()
{
base.OnAppearing();

if (DeviceInfo.Platform == DevicePlatform.iOS)
{
TypeFaceFor = SKTypeface.FromFamilyName("Apple SD Gothic Neo");
}
else
{
TypeFaceFor = GetSkiaTypefaceFromAssetFont();
}

Chart1.Chart = new RadarChart()
{
LabelTextSize = 50f,
Entries = entries,
BorderLineSize = 0f,
Typeface = TypeFaceFor,
LineSize = 1f,
BorderLineColor = SKColor.Parse("#ffffaa")
}

}

public SKTypeface GetSkiaTypefaceFromAssetFont()
{
SkiaSharp.SKTypeface typeFace;
using (var asset = FileSystem.OpenAppPackageFileAsync("NanumBarunGothic.ttf"))
{
typeFace = SKTypeface.FromStream(asset.Result);
}
return typeFace;
}

 

참고. 갤럭시8노트 내장 폰트 Family Name List

Font______________sans-serif
Font______________arial
Font______________helvetica
Font______________tahoma
Font______________verdana
Font______________sans-serif-thin
Font______________sans-serif-light
Font______________sans-serif-medium
Font______________sans-serif-black
Font______________sans-serif-condensed
Font______________sans-serif-condensed-light
Font______________sans-serif-condensed-medium
Font______________serif
Font______________times
Font______________times new roman
Font______________palatino
Font______________georgia
Font______________baskerville
Font______________goudy
Font______________fantasy
Font______________itc stone serif
Font______________monospace
Font______________sans-serif-monospace
Font______________monaco
Font______________serif-monospace
Font______________courier
Font______________courier new
Font______________casual
Font______________cursive
Font______________sans-serif-smallcaps
Font______________sec-roboto-light
Font______________sec-roboto-condensed
Font______________sec-roboto-condensed-light
Font______________sec-400
Font______________samsungoneui-num500
Font______________samsung-neo-num3t-cond
Font______________samsung-neo-num3t
Font______________samsung-neo-num3l
Font______________samsung-neo-num3r
Font______________roboto-num3l
Font______________roboto-num3r
Font______________clock2016
Font______________clock2017l
Font______________clock2017r Font______________clock2019l

반응형

'Xamarin' 카테고리의 다른 글

DatePicker Format String = 2020-12-29(화)  (0) 2020.12.29
Xamarin.Android http 통신 허용  (0) 2020.12.11
JSON to DataTable  (0) 2020.09.18
Android, iOS Device System Setting Open  (0) 2020.06.25
Azure Notification Hubs - Google FireBase API KEY  (0) 2020.06.15
댓글