2 * Copyright © 2015-2019 Ebrahim Byagowi
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27 #ifdef HAVE_DIRECTWRITE
29 #include "hb-shaper-impl.hh"
33 #include "hb-directwrite.h"
35 #include "hb-ms-feature-ranges.hh"
38 * SECTION:hb-directwrite
39 * @title: hb-directwrite
40 * @short_description: DirectWrite integration
41 * @include: hb-directwrite.h
43 * Functions for using HarfBuzz with DirectWrite fonts.
47 * DirectWrite font stream helpers
50 // This is a font loader which provides only one font (unlike its original design).
51 // For a better implementation which was also source of this
52 // and DWriteFontFileStream, have a look at to NativeFontResourceDWrite.cpp in Mozilla
53 class DWriteFontFileLoader : public IDWriteFontFileLoader
56 IDWriteFontFileStream *mFontFileStream;
58 DWriteFontFileLoader (IDWriteFontFileStream *fontFileStream)
59 { mFontFileStream = fontFileStream; }
62 IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
64 IFACEMETHOD_ (ULONG, AddRef) () { return 1; }
65 IFACEMETHOD_ (ULONG, Release) () { return 1; }
67 // IDWriteFontFileLoader methods
68 virtual HRESULT STDMETHODCALLTYPE
69 CreateStreamFromKey (void const* fontFileReferenceKey,
70 uint32_t fontFileReferenceKeySize,
71 OUT IDWriteFontFileStream** fontFileStream)
73 *fontFileStream = mFontFileStream;
77 virtual ~DWriteFontFileLoader() {}
80 class DWriteFontFileStream : public IDWriteFontFileStream
86 DWriteFontFileStream (uint8_t *aData, uint32_t aSize)
93 IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
95 IFACEMETHOD_ (ULONG, AddRef) () { return 1; }
96 IFACEMETHOD_ (ULONG, Release) () { return 1; }
98 // IDWriteFontFileStream methods
99 virtual HRESULT STDMETHODCALLTYPE
100 ReadFileFragment (void const** fragmentStart,
103 OUT void** fragmentContext)
105 // We are required to do bounds checking.
106 if (fileOffset + fragmentSize > mSize) return E_FAIL;
108 // truncate the 64 bit fileOffset to size_t sized index into mData
109 size_t index = static_cast<size_t> (fileOffset);
111 // We should be alive for the duration of this.
112 *fragmentStart = &mData[index];
113 *fragmentContext = nullptr;
117 virtual void STDMETHODCALLTYPE
118 ReleaseFileFragment (void* fragmentContext) {}
120 virtual HRESULT STDMETHODCALLTYPE
121 GetFileSize (OUT UINT64* fileSize)
127 virtual HRESULT STDMETHODCALLTYPE
128 GetLastWriteTime (OUT UINT64* lastWriteTime) { return E_NOTIMPL; }
130 virtual ~DWriteFontFileStream() {}
138 struct hb_directwrite_face_data_t
140 IDWriteFactory *dwriteFactory;
141 IDWriteFontFile *fontFile;
142 DWriteFontFileStream *fontFileStream;
143 DWriteFontFileLoader *fontFileLoader;
144 IDWriteFontFace *fontFace;
148 hb_directwrite_face_data_t *
149 _hb_directwrite_shaper_face_data_create (hb_face_t *face)
151 hb_directwrite_face_data_t *data = new hb_directwrite_face_data_t;
152 if (unlikely (!data))
157 DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
163 // TODO: factory and fontFileLoader should be cached separately
164 IDWriteFactory* dwriteFactory;
165 hr = DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
166 (IUnknown**) &dwriteFactory);
168 if (unlikely (hr != S_OK))
169 FAIL ("Failed to run DWriteCreateFactory().");
171 hb_blob_t *blob = hb_face_reference_blob (face);
172 DWriteFontFileStream *fontFileStream;
173 fontFileStream = new DWriteFontFileStream ((uint8_t *) hb_blob_get_data (blob, nullptr),
174 hb_blob_get_length (blob));
176 DWriteFontFileLoader *fontFileLoader = new DWriteFontFileLoader (fontFileStream);
177 dwriteFactory->RegisterFontFileLoader (fontFileLoader);
179 IDWriteFontFile *fontFile;
180 uint64_t fontFileKey = 0;
181 hr = dwriteFactory->CreateCustomFontFileReference (&fontFileKey, sizeof (fontFileKey),
182 fontFileLoader, &fontFile);
185 FAIL ("Failed to load font file from data!");
188 DWRITE_FONT_FILE_TYPE fileType;
189 DWRITE_FONT_FACE_TYPE faceType;
190 uint32_t numberOfFaces;
191 hr = fontFile->Analyze (&isSupported, &fileType, &faceType, &numberOfFaces);
192 if (FAILED (hr) || !isSupported)
193 FAIL ("Font file is not supported.");
197 IDWriteFontFace *fontFace;
198 dwriteFactory->CreateFontFace (faceType, 1, &fontFile, 0,
199 DWRITE_FONT_SIMULATIONS_NONE, &fontFace);
201 data->dwriteFactory = dwriteFactory;
202 data->fontFile = fontFile;
203 data->fontFileStream = fontFileStream;
204 data->fontFileLoader = fontFileLoader;
205 data->fontFace = fontFace;
206 data->faceBlob = blob;
212 _hb_directwrite_shaper_face_data_destroy (hb_directwrite_face_data_t *data)
215 data->fontFace->Release ();
217 data->fontFile->Release ();
218 if (data->dwriteFactory)
220 if (data->fontFileLoader)
221 data->dwriteFactory->UnregisterFontFileLoader (data->fontFileLoader);
222 data->dwriteFactory->Release ();
224 if (data->fontFileLoader)
225 delete data->fontFileLoader;
226 if (data->fontFileStream)
227 delete data->fontFileStream;
229 hb_blob_destroy (data->faceBlob);
239 struct hb_directwrite_font_data_t {};
241 hb_directwrite_font_data_t *
242 _hb_directwrite_shaper_font_data_create (hb_font_t *font)
244 hb_directwrite_font_data_t *data = new hb_directwrite_font_data_t;
245 if (unlikely (!data))
252 _hb_directwrite_shaper_font_data_destroy (hb_directwrite_font_data_t *data)
258 // Most of TextAnalysis is originally written by Bas Schouten for Mozilla project
259 // but now is relicensed to MIT for HarfBuzz use
260 class TextAnalysis : public IDWriteTextAnalysisSource, public IDWriteTextAnalysisSink
264 IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
266 IFACEMETHOD_ (ULONG, AddRef) () { return 1; }
267 IFACEMETHOD_ (ULONG, Release) () { return 1; }
269 // A single contiguous run of characters containing the same analysis
273 uint32_t mTextStart; // starting text position of this run
274 uint32_t mTextLength; // number of contiguous code units covered
275 uint32_t mGlyphStart; // starting glyph in the glyphs array
276 uint32_t mGlyphCount; // number of glyphs associated with this run
278 DWRITE_SCRIPT_ANALYSIS mScript;
282 bool ContainsTextPosition (uint32_t aTextPosition) const
284 return aTextPosition >= mTextStart &&
285 aTextPosition < mTextStart + mTextLength;
292 TextAnalysis (const wchar_t* text, uint32_t textLength,
293 const wchar_t* localeName, DWRITE_READING_DIRECTION readingDirection)
294 : mTextLength (textLength), mText (text), mLocaleName (localeName),
295 mReadingDirection (readingDirection), mCurrentRun (nullptr) {}
298 // delete runs, except mRunHead which is part of the TextAnalysis object
299 for (Run *run = mRunHead.nextRun; run;)
308 GenerateResults (IDWriteTextAnalyzer* textAnalyzer, Run **runHead)
310 // Analyzes the text using the script analyzer and returns
311 // the result as a series of runs.
315 // Initially start out with one result that covers the entire range.
316 // This result will be subdivided by the analysis processes.
317 mRunHead.mTextStart = 0;
318 mRunHead.mTextLength = mTextLength;
319 mRunHead.mBidiLevel =
320 (mReadingDirection == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT);
321 mRunHead.nextRun = nullptr;
322 mCurrentRun = &mRunHead;
324 // Call each of the analyzers in sequence, recording their results.
325 if (SUCCEEDED (hr = textAnalyzer->AnalyzeScript (this, 0, mTextLength, this)))
326 *runHead = &mRunHead;
331 // IDWriteTextAnalysisSource implementation
334 GetTextAtPosition (uint32_t textPosition,
335 OUT wchar_t const** textString,
336 OUT uint32_t* textLength)
338 if (textPosition >= mTextLength)
340 // No text at this position, valid query though.
341 *textString = nullptr;
346 *textString = mText + textPosition;
347 *textLength = mTextLength - textPosition;
353 GetTextBeforePosition (uint32_t textPosition,
354 OUT wchar_t const** textString,
355 OUT uint32_t* textLength)
357 if (textPosition == 0 || textPosition > mTextLength)
359 // Either there is no text before here (== 0), or this
360 // is an invalid position. The query is considered valid though.
361 *textString = nullptr;
367 *textLength = textPosition;
372 IFACEMETHODIMP_ (DWRITE_READING_DIRECTION)
373 GetParagraphReadingDirection () { return mReadingDirection; }
375 IFACEMETHODIMP GetLocaleName (uint32_t textPosition, uint32_t* textLength,
376 wchar_t const** localeName)
380 GetNumberSubstitution (uint32_t textPosition,
381 OUT uint32_t* textLength,
382 OUT IDWriteNumberSubstitution** numberSubstitution)
384 // We do not support number substitution.
385 *numberSubstitution = nullptr;
386 *textLength = mTextLength - textPosition;
391 // IDWriteTextAnalysisSink implementation
394 SetScriptAnalysis (uint32_t textPosition, uint32_t textLength,
395 DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis)
397 SetCurrentRun (textPosition);
398 SplitCurrentRun (textPosition);
399 while (textLength > 0)
401 Run *run = FetchNextRun (&textLength);
402 run->mScript = *scriptAnalysis;
409 SetLineBreakpoints (uint32_t textPosition,
411 const DWRITE_LINE_BREAKPOINT* lineBreakpoints)
414 IFACEMETHODIMP SetBidiLevel (uint32_t textPosition, uint32_t textLength,
415 uint8_t explicitLevel, uint8_t resolvedLevel)
419 SetNumberSubstitution (uint32_t textPosition, uint32_t textLength,
420 IDWriteNumberSubstitution* numberSubstitution)
424 Run *FetchNextRun (IN OUT uint32_t* textLength)
426 // Used by the sink setters, this returns a reference to the next run.
427 // Position and length are adjusted to now point after the current run
430 Run *origRun = mCurrentRun;
431 // Split the tail if needed (the length remaining is less than the
432 // current run's size).
433 if (*textLength < mCurrentRun->mTextLength)
434 SplitCurrentRun (mCurrentRun->mTextStart + *textLength);
436 // Just advance the current run.
437 mCurrentRun = mCurrentRun->nextRun;
438 *textLength -= origRun->mTextLength;
440 // Return a reference to the run that was just current.
444 void SetCurrentRun (uint32_t textPosition)
446 // Move the current run to the given position.
447 // Since the analyzers generally return results in a forward manner,
448 // this will usually just return early. If not, find the
449 // corresponding run for the text position.
451 if (mCurrentRun && mCurrentRun->ContainsTextPosition (textPosition))
454 for (Run *run = &mRunHead; run; run = run->nextRun)
455 if (run->ContainsTextPosition (textPosition))
460 assert (0); // We should always be able to find the text position in one of our runs
463 void SplitCurrentRun (uint32_t splitPosition)
467 assert (0); // SplitCurrentRun called without current run
468 // Shouldn't be calling this when no current run is set!
471 // Split the current run.
472 if (splitPosition <= mCurrentRun->mTextStart)
474 // No need to split, already the start of a run
475 // or before it. Usually the first.
478 Run *newRun = new Run;
480 *newRun = *mCurrentRun;
482 // Insert the new run in our linked list.
483 newRun->nextRun = mCurrentRun->nextRun;
484 mCurrentRun->nextRun = newRun;
486 // Adjust runs' text positions and lengths.
487 uint32_t splitPoint = splitPosition - mCurrentRun->mTextStart;
488 newRun->mTextStart += splitPoint;
489 newRun->mTextLength -= splitPoint;
490 mCurrentRun->mTextLength = splitPoint;
491 mCurrentRun = newRun;
496 // (weak references are fine here, since this class is a transient
497 // stack-based helper that doesn't need to copy data)
498 uint32_t mTextLength;
499 const wchar_t* mText;
500 const wchar_t* mLocaleName;
501 DWRITE_READING_DIRECTION mReadingDirection;
503 // Current processing state.
506 // Output is a list of runs starting here
515 _hb_directwrite_shape (hb_shape_plan_t *shape_plan,
518 const hb_feature_t *features,
519 unsigned int num_features)
521 hb_face_t *face = font->face;
522 const hb_directwrite_face_data_t *face_data = face->data.directwrite;
523 IDWriteFactory *dwriteFactory = face_data->dwriteFactory;
524 IDWriteFontFace *fontFace = face_data->fontFace;
526 IDWriteTextAnalyzer* analyzer;
527 dwriteFactory->CreateTextAnalyzer (&analyzer);
529 unsigned int scratch_size;
530 hb_buffer_t::scratch_buffer_t *scratch = buffer->get_scratch_buffer (&scratch_size);
531 #define ALLOCATE_ARRAY(Type, name, len) \
532 Type *name = (Type *) scratch; \
534 unsigned int _consumed = DIV_CEIL ((len) * sizeof (Type), sizeof (*scratch)); \
535 assert (_consumed <= scratch_size); \
536 scratch += _consumed; \
537 scratch_size -= _consumed; \
540 #define utf16_index() var1.u32
542 ALLOCATE_ARRAY (wchar_t, textString, buffer->len * 2);
544 unsigned int chars_len = 0;
545 for (unsigned int i = 0; i < buffer->len; i++)
547 hb_codepoint_t c = buffer->info[i].codepoint;
548 buffer->info[i].utf16_index () = chars_len;
549 if (likely (c <= 0xFFFFu))
550 textString[chars_len++] = c;
551 else if (unlikely (c > 0x10FFFFu))
552 textString[chars_len++] = 0xFFFDu;
555 textString[chars_len++] = 0xD800u + ((c - 0x10000u) >> 10);
556 textString[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1u << 10) - 1));
560 ALLOCATE_ARRAY (WORD, log_clusters, chars_len);
561 /* Need log_clusters to assign features. */
563 for (unsigned int i = 0; i < buffer->len; i++)
565 hb_codepoint_t c = buffer->info[i].codepoint;
566 unsigned int cluster = buffer->info[i].cluster;
567 log_clusters[chars_len++] = cluster;
568 if (hb_in_range (c, 0x10000u, 0x10FFFFu))
569 log_clusters[chars_len++] = cluster; /* Surrogates. */
572 DWRITE_READING_DIRECTION readingDirection;
573 readingDirection = buffer->props.direction ?
574 DWRITE_READING_DIRECTION_RIGHT_TO_LEFT :
575 DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
578 * There's an internal 16-bit limit on some things inside the analyzer,
579 * but we never attempt to shape a word longer than 64K characters
580 * in a single gfxShapedWord, so we cannot exceed that limit.
582 uint32_t textLength = chars_len;
584 TextAnalysis analysis (textString, textLength, nullptr, readingDirection);
585 TextAnalysis::Run *runHead;
587 hr = analysis.GenerateResults (analyzer, &runHead);
591 DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
596 FAIL ("Analyzer failed to generate results.");
598 uint32_t maxGlyphCount = 3 * textLength / 2 + 16;
600 bool isRightToLeft = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
602 const wchar_t localeName[20] = {0};
603 if (buffer->props.language)
604 mbstowcs ((wchar_t*) localeName,
605 hb_language_to_string (buffer->props.language), 20);
610 static_assert ((sizeof (DWRITE_TYPOGRAPHIC_FEATURES) == sizeof (hb_ms_features_t)), "");
611 static_assert ((sizeof (DWRITE_FONT_FEATURE) == sizeof (hb_ms_feature_t)), "");
612 hb_vector_t<hb_ms_features_t *> range_features;
613 hb_vector_t<uint32_t> range_char_counts;
616 hb_vector_t<hb_ms_feature_t> feature_records;
617 hb_vector_t<hb_ms_range_record_t> range_records;
618 if (hb_ms_setup_features (features, num_features, feature_records, range_records))
619 hb_ms_make_feature_ranges (feature_records,
628 uint16_t* clusterMap;
629 clusterMap = new uint16_t[textLength];
630 DWRITE_SHAPING_TEXT_PROPERTIES* textProperties;
631 textProperties = new DWRITE_SHAPING_TEXT_PROPERTIES[textLength];
634 uint16_t* glyphIndices = new uint16_t[maxGlyphCount];
635 DWRITE_SHAPING_GLYPH_PROPERTIES* glyphProperties;
636 glyphProperties = new DWRITE_SHAPING_GLYPH_PROPERTIES[maxGlyphCount];
638 hr = analyzer->GetGlyphs (textString,
646 (const DWRITE_TYPOGRAPHIC_FEATURES**) range_features.arrayZ,
647 range_char_counts.arrayZ,
648 range_features.length,
656 if (unlikely (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER)))
658 delete [] glyphIndices;
659 delete [] glyphProperties;
663 goto retry_getglyphs;
666 FAIL ("Analyzer failed to get glyphs.");
668 float* glyphAdvances = new float[maxGlyphCount];
669 DWRITE_GLYPH_OFFSET* glyphOffsets = new DWRITE_GLYPH_OFFSET[maxGlyphCount];
671 /* The -2 in the following is to compensate for possible
672 * alignment needed after the WORD array. sizeof (WORD) == 2. */
673 unsigned int glyphs_size = (scratch_size * sizeof (int) - 2)
675 sizeof (DWRITE_SHAPING_GLYPH_PROPERTIES) +
677 sizeof (DWRITE_GLYPH_OFFSET) +
679 ALLOCATE_ARRAY (uint32_t, vis_clusters, glyphs_size);
681 #undef ALLOCATE_ARRAY
683 int fontEmSize = font->face->get_upem ();
684 if (fontEmSize < 0) fontEmSize = -fontEmSize;
686 if (fontEmSize < 0) fontEmSize = -fontEmSize;
687 double x_mult = (double) font->x_scale / fontEmSize;
688 double y_mult = (double) font->y_scale / fontEmSize;
690 hr = analyzer->GetGlyphPlacements (textString,
703 (const DWRITE_TYPOGRAPHIC_FEATURES**) range_features.arrayZ,
704 range_char_counts.arrayZ,
705 range_features.length,
710 FAIL ("Analyzer failed to get glyph placements.");
712 /* Ok, we've got everything we need, now compose output buffer,
713 * very, *very*, carefully! */
715 /* Calculate visual-clusters. That's what we ship. */
716 for (unsigned int i = 0; i < glyphCount; i++)
717 vis_clusters[i] = (uint32_t) -1;
718 for (unsigned int i = 0; i < buffer->len; i++)
721 &vis_clusters[log_clusters[buffer->info[i].utf16_index ()]];
722 *p = hb_min (*p, buffer->info[i].cluster);
724 for (unsigned int i = 1; i < glyphCount; i++)
725 if (vis_clusters[i] == (uint32_t) -1)
726 vis_clusters[i] = vis_clusters[i - 1];
730 if (unlikely (!buffer->ensure (glyphCount)))
731 FAIL ("Buffer in error");
735 /* Set glyph infos */
737 for (unsigned int i = 0; i < glyphCount; i++)
739 hb_glyph_info_t *info = &buffer->info[buffer->len++];
741 info->codepoint = glyphIndices[i];
742 info->cluster = vis_clusters[i];
744 /* The rest is crap. Let's store position info there for now. */
745 info->mask = glyphAdvances[i];
746 info->var1.i32 = glyphOffsets[i].advanceOffset;
747 info->var2.i32 = glyphOffsets[i].ascenderOffset;
750 /* Set glyph positions */
751 buffer->clear_positions ();
752 for (unsigned int i = 0; i < glyphCount; i++)
754 hb_glyph_info_t *info = &buffer->info[i];
755 hb_glyph_position_t *pos = &buffer->pos[i];
758 pos->x_advance = x_mult * (int32_t) info->mask;
759 pos->x_offset = x_mult * (isRightToLeft ? -info->var1.i32 : info->var1.i32);
760 pos->y_offset = y_mult * info->var2.i32;
763 if (isRightToLeft) hb_buffer_reverse (buffer);
765 buffer->clear_glyph_flags ();
766 buffer->unsafe_to_break ();
768 delete [] clusterMap;
769 delete [] glyphIndices;
770 delete [] textProperties;
771 delete [] glyphProperties;
772 delete [] glyphAdvances;
773 delete [] glyphOffsets;
779 struct _hb_directwrite_font_table_context {
780 IDWriteFontFace *face;
785 _hb_directwrite_table_data_release (void *data)
787 _hb_directwrite_font_table_context *context = (_hb_directwrite_font_table_context *) data;
788 context->face->ReleaseFontTable (context->table_context);
793 _hb_directwrite_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
795 IDWriteFontFace *dw_face = ((IDWriteFontFace *) user_data);
800 if (!dw_face || FAILED (dw_face->TryGetFontTable (hb_uint32_swap (tag), &data,
801 &length, &table_context, &exists)))
804 if (!data || !exists || !length)
806 dw_face->ReleaseFontTable (table_context);
810 _hb_directwrite_font_table_context *context = (_hb_directwrite_font_table_context *) hb_malloc (sizeof (_hb_directwrite_font_table_context));
811 context->face = dw_face;
812 context->table_context = table_context;
814 return hb_blob_create ((const char *) data, length, HB_MEMORY_MODE_READONLY,
815 context, _hb_directwrite_table_data_release);
819 _hb_directwrite_font_release (void *data)
822 ((IDWriteFontFace *) data)->Release ();
826 * hb_directwrite_face_create:
827 * @font_face: a DirectWrite IDWriteFontFace object.
829 * Constructs a new face object from the specified DirectWrite IDWriteFontFace.
831 * Return value: #hb_face_t object corresponding to the given input
836 hb_directwrite_face_create (IDWriteFontFace *font_face)
839 font_face->AddRef ();
840 return hb_face_create_for_tables (_hb_directwrite_reference_table, font_face,
841 _hb_directwrite_font_release);
845 * hb_directwrite_face_get_font_face:
846 * @face: a #hb_face_t object
848 * Gets the DirectWrite IDWriteFontFace associated with @face.
850 * Return value: DirectWrite IDWriteFontFace object corresponding to the given input
855 hb_directwrite_face_get_font_face (hb_face_t *face)
857 return face->data.directwrite->fontFace;