mirror of
https://gitee.com/csharpui/CPF.git
synced 2026-08-27 19:17:05 +08:00
初始化
This commit is contained in:
43
CPF.Mac/Mac/CoreText/CTBaselineFondID.cs
Normal file
43
CPF.Mac/Mac/CoreText/CTBaselineFondID.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using CPF.Mac.Foundation;
|
||||
using CPF.Mac.ObjCRuntime;
|
||||
using System;
|
||||
|
||||
namespace CPF.Mac.CoreText
|
||||
{
|
||||
internal static class CTBaselineFondID
|
||||
{
|
||||
public static readonly NSString Reference;
|
||||
|
||||
public static readonly NSString Original;
|
||||
|
||||
static CTBaselineFondID()
|
||||
{
|
||||
IntPtr intPtr = Dlfcn.dlopen("/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/CoreText", 0);
|
||||
if (!(intPtr == IntPtr.Zero))
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference = Dlfcn.GetStringConstant(intPtr, "kCTBaselineReferenceFont");
|
||||
Original = Dlfcn.GetStringConstant(intPtr, "kCTBaselineOriginalFont");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Dlfcn.dlclose(intPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static NSString ToNSString(CTBaselineFont key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case CTBaselineFont.Reference:
|
||||
return Reference;
|
||||
case CTBaselineFont.Original:
|
||||
return Original;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("key");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user