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);
Exemple #2
0
        public virtual int SetFontStretch(
            DWRITE_FONT_STRETCH fontStretch,
            DWRITE_TEXT_RANGE textRange
            )
        {
            var fp = GetFunctionPointer(34);

            if (m_SetFontStretchFunc == null)
            {
                m_SetFontStretchFunc = (SetFontStretchFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(SetFontStretchFunc));
            }

            return(m_SetFontStretchFunc(m_ptr, fontStretch, textRange));
        }
Exemple #3
0
        public virtual int GetFontStretch(
            uint currentPosition,
            out DWRITE_FONT_STRETCH fontStretch,
            out DWRITE_TEXT_RANGE textRange
            )
        {
            var fp = GetFunctionPointer(49);

            if (m_GetFontStretchFunc == null)
            {
                m_GetFontStretchFunc = (GetFontStretchFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(GetFontStretchFunc));
            }

            return(m_GetFontStretchFunc(m_ptr, currentPosition, out fontStretch, out textRange));
        }
        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));
        }
Exemple #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));
 }
Exemple #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 SetFontStretch(DWRITE_FONT_STRETCH fontStretch, DWRITE_TEXT_RANGE textRange)
 {
     return(((delegate * unmanaged <IDWriteTextLayout *, DWRITE_FONT_STRETCH, DWRITE_TEXT_RANGE, int>)(lpVtbl[34]))((IDWriteTextLayout *)Unsafe.AsPointer(ref this), fontStretch, textRange));
 }
Exemple #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));
 }
 internal static FontStretch Convert(DWRITE_FONT_STRETCH fontStrech)
 {
 }