public static IComObject <IDWriteTextFormat> CreateTextFormat(this IComObject <IDWriteFactory> factory,
                                                               string familyName,
                                                               float size,
                                                               IDWriteFontCollection fonts = null,
                                                               DWRITE_FONT_WEIGHT weight   = DWRITE_FONT_WEIGHT.DWRITE_FONT_WEIGHT_NORMAL,
                                                               DWRITE_FONT_STYLE style     = DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL,
                                                               DWRITE_FONT_STRETCH stretch = DWRITE_FONT_STRETCH.DWRITE_FONT_STRETCH_NORMAL,
                                                               string localeName           = null) => CreateTextFormat <IDWriteTextFormat>(factory?.Object, familyName, size, fonts, weight, style, stretch, localeName);
Esempio n. 2
0
        public virtual int SetFontStyle(
            DWRITE_FONT_STYLE fontStyle,
            DWRITE_TEXT_RANGE textRange
            )
        {
            var fp = GetFunctionPointer(33);

            if (m_SetFontStyleFunc == null)
            {
                m_SetFontStyleFunc = (SetFontStyleFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(SetFontStyleFunc));
            }

            return(m_SetFontStyleFunc(m_ptr, fontStyle, textRange));
        }
Esempio n. 3
0
        public virtual int GetFontStyle(
            uint currentPosition,
            out DWRITE_FONT_STYLE fontStyle,
            out DWRITE_TEXT_RANGE textRange
            )
        {
            var fp = GetFunctionPointer(48);

            if (m_GetFontStyleFunc == null)
            {
                m_GetFontStyleFunc = (GetFontStyleFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(GetFontStyleFunc));
            }

            return(m_GetFontStyleFunc(m_ptr, currentPosition, out fontStyle, out textRange));
        }
Esempio n. 4
0
        public virtual int GetMatchingFonts(
            DWRITE_FONT_WEIGHT weight,
            DWRITE_FONT_STRETCH stretch,
            DWRITE_FONT_STYLE style,
            out IDWriteFontList matchingFonts
            )
        {
            var fp = GetFunctionPointer(8);

            if (m_GetMatchingFontsFunc == null)
            {
                m_GetMatchingFontsFunc = (GetMatchingFontsFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(GetMatchingFontsFunc));
            }
            matchingFonts = new IDWriteFontList();
            return(m_GetMatchingFontsFunc(m_ptr, weight, stretch, style, out matchingFonts.PtrForNew));
        }
Esempio n. 5
0
        public virtual int CreateTextFormat(
            ref ushort fontFamilyName,
            IDWriteFontCollection fontCollection,
            DWRITE_FONT_WEIGHT fontWeight,
            DWRITE_FONT_STYLE fontStyle,
            DWRITE_FONT_STRETCH fontStretch,
            float fontSize,
            ref ushort localeName,
            out IDWriteTextFormat textFormat
            )
        {
            var fp = GetFunctionPointer(15);

            if (m_CreateTextFormatFunc == null)
            {
                m_CreateTextFormatFunc = (CreateTextFormatFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateTextFormatFunc));
            }
            textFormat = new IDWriteTextFormat();
            return(m_CreateTextFormatFunc(m_ptr, ref fontFamilyName, fontCollection != null ? fontCollection.Ptr : IntPtr.Zero, fontWeight, fontStyle, fontStretch, fontSize, ref localeName, out textFormat.PtrForNew));
        }
        public static IComObject <T> CreateTextFormat <T>(this IDWriteFactory factory,
                                                          string familyName,
                                                          float size,
                                                          IDWriteFontCollection fonts = null,
                                                          DWRITE_FONT_WEIGHT weight   = DWRITE_FONT_WEIGHT.DWRITE_FONT_WEIGHT_NORMAL,
                                                          DWRITE_FONT_STYLE style     = DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL,
                                                          DWRITE_FONT_STRETCH stretch = DWRITE_FONT_STRETCH.DWRITE_FONT_STRETCH_NORMAL,
                                                          string localeName           = null) where T : IDWriteTextFormat
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            if (familyName == null)
            {
                throw new ArgumentNullException(nameof(familyName));
            }

            localeName = localeName ?? string.Empty;
            factory.CreateTextFormat(familyName, fonts, weight, style, stretch, size, localeName, out var format).ThrowOnError();
            return(new ComObject <T>((T)format));
        }
 public int CreateTextFormat([NativeTypeName("const WCHAR *")] ushort *fontFamilyName, [NativeTypeName("IDWriteFontCollection *")] IDWriteFontCollection *fontCollection, DWRITE_FONT_WEIGHT fontWeight, DWRITE_FONT_STYLE fontStyle, DWRITE_FONT_STRETCH fontStretch, [NativeTypeName("FLOAT")] float fontSize, [NativeTypeName("const WCHAR *")] ushort *localeName, [NativeTypeName("IDWriteTextFormat **")] IDWriteTextFormat **textFormat)
 {
     return(((delegate * unmanaged <IDWriteFactory1 *, ushort *, IDWriteFontCollection *, DWRITE_FONT_WEIGHT, DWRITE_FONT_STYLE, DWRITE_FONT_STRETCH, float, ushort *, IDWriteTextFormat **, int>)(lpVtbl[15]))((IDWriteFactory1 *)Unsafe.AsPointer(ref this), fontFamilyName, fontCollection, fontWeight, fontStyle, fontStretch, fontSize, localeName, textFormat));
 }
 public HRESULT GetMatchingFonts(DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFontList **matchingFonts)
 {
     return(((delegate * unmanaged <IDWriteFontFamily *, DWRITE_FONT_WEIGHT, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, IDWriteFontList **, int>)(lpVtbl[8]))((IDWriteFontFamily *)Unsafe.AsPointer(ref this), weight, stretch, style, matchingFonts));
 }
 public HRESULT GetMatchingFonts([NativeTypeName("const WCHAR *")] ushort *familyName, DWRITE_FONT_WEIGHT fontWeight, DWRITE_FONT_STRETCH fontStretch, DWRITE_FONT_STYLE fontStyle, IDWriteFontSet **filteredSet)
 {
     return(((delegate * unmanaged <IDWriteFontSet *, ushort *, DWRITE_FONT_WEIGHT, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, IDWriteFontSet **, int>)(lpVtbl[11]))((IDWriteFontSet *)Unsafe.AsPointer(ref this), familyName, fontWeight, fontStretch, fontStyle, filteredSet));
 }
Esempio n. 10
0
 public int GetFirstMatchingFont(DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, [NativeTypeName("IDWriteFont **")] IDWriteFont **matchingFont)
 {
     return(((delegate * unmanaged <IDWriteFontFamily1 *, DWRITE_FONT_WEIGHT, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, IDWriteFont **, int>)(lpVtbl[7]))((IDWriteFontFamily1 *)Unsafe.AsPointer(ref this), weight, stretch, style, matchingFont));
 }
 public int SetFontStyle(DWRITE_FONT_STYLE fontStyle, DWRITE_TEXT_RANGE textRange)
 {
     return(((delegate * unmanaged <IDWriteTextLayout *, DWRITE_FONT_STYLE, DWRITE_TEXT_RANGE, int>)(lpVtbl[33]))((IDWriteTextLayout *)Unsafe.AsPointer(ref this), fontStyle, textRange));
 }
Esempio n. 12
0
 public int MapCharacters([NativeTypeName("IDWriteTextAnalysisSource *")] IDWriteTextAnalysisSource *analysisSource, [NativeTypeName("UINT32")] uint textPosition, [NativeTypeName("UINT32")] uint textLength, [NativeTypeName("IDWriteFontCollection *")] IDWriteFontCollection *baseFontCollection, [NativeTypeName("const wchar_t *")] ushort *baseFamilyName, DWRITE_FONT_WEIGHT baseWeight, DWRITE_FONT_STYLE baseStyle, DWRITE_FONT_STRETCH baseStretch, [NativeTypeName("UINT32 *")] uint *mappedLength, [NativeTypeName("IDWriteFont **")] IDWriteFont **mappedFont, [NativeTypeName("FLOAT *")] float *scale)
 {
     return(((delegate * unmanaged <IDWriteFontFallback1 *, IDWriteTextAnalysisSource *, uint, uint, IDWriteFontCollection *, ushort *, DWRITE_FONT_WEIGHT, DWRITE_FONT_STYLE, DWRITE_FONT_STRETCH, uint *, IDWriteFont **, float *, int>)(lpVtbl[3]))((IDWriteFontFallback1 *)Unsafe.AsPointer(ref this), analysisSource, textPosition, textLength, baseFontCollection, baseFamilyName, baseWeight, baseStyle, baseStretch, mappedLength, mappedFont, scale));
 }
Esempio n. 13
0
 internal static FontStyle Convert(DWRITE_FONT_STYLE fontStyle)
 {
 }