minor style fix, use void in methods on no argument

This commit is contained in:
Ebrahim Byagowi 2018-12-12 15:14:37 +03:30 committed by GitHub
parent a33f238f88
commit 7ee5c52345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 211 additions and 262 deletions

View File

@ -40,11 +40,11 @@ namespace AAT {
struct FontDescriptor struct FontDescriptor
{ {
inline bool has_data () const { return tag; } inline bool has_data (void) const { return tag; }
inline int cmp (hb_tag_t a) const { return tag.cmp (a); } inline int cmp (hb_tag_t a) const { return tag.cmp (a); }
inline float get_value () const { return u.value.to_float (); } inline float get_value (void) const { return u.value.to_float (); }
enum non_alphabetic_value_t { enum non_alphabetic_value_t {
Alphabetic = 0, Alphabetic = 0,

View File

@ -513,10 +513,8 @@ struct StateTable
return (this+classTable).get_class (glyph_id, num_glyphs, 1); return (this+classTable).get_class (glyph_id, num_glyphs, 1);
} }
inline const Entry<Extra> *get_entries () const inline const Entry<Extra> *get_entries (void) const
{ { return (this+entryTable).arrayZ; }
return (this+entryTable).arrayZ;
}
inline const Entry<Extra> *get_entryZ (int state, unsigned int klass) const inline const Entry<Extra> *get_entryZ (int state, unsigned int klass) const
{ {

View File

@ -125,10 +125,10 @@ struct FeatureName
return settings_table.len; return settings_table.len;
} }
inline hb_aat_layout_feature_type_t get_feature_type () const inline hb_aat_layout_feature_type_t get_feature_type (void) const
{ return (hb_aat_layout_feature_type_t) (unsigned int) feature; } { return (hb_aat_layout_feature_type_t) (unsigned int) feature; }
inline hb_ot_name_id_t get_feature_name_id () const { return nameIndex; } inline hb_ot_name_id_t get_feature_name_id (void) const { return nameIndex; }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{ {

View File

@ -46,25 +46,19 @@ struct TrackTableEntry
{ {
friend struct TrackData; friend struct TrackData;
inline float get_track_value () const inline float get_track_value (void) const { return track.to_float (); }
{
return track.to_float ();
}
inline int get_value (const void *base, inline int get_value (const void *base, unsigned int index,
unsigned int index, unsigned int table_size) const
unsigned int nSizes) const { return (base+valuesZ).as_array (table_size)[index]; }
{
return (base+valuesZ).as_array (nSizes)[index];
}
public: public:
inline bool sanitize (hb_sanitize_context_t *c, const void *base, inline bool sanitize (hb_sanitize_context_t *c, const void *base,
unsigned int nSizes) const unsigned int table_size) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) && return_trace (likely (c->check_struct (this) &&
(valuesZ.sanitize (c, base, nSizes)))); (valuesZ.sanitize (c, base, table_size))));
} }
protected: protected:

View File

@ -361,7 +361,9 @@ hb_aat_layout_get_feature_types (hb_face_t *face,
hb_ot_name_id_t hb_ot_name_id_t
hb_aat_layout_feature_type_get_name_id (hb_face_t *face, hb_aat_layout_feature_type_get_name_id (hb_face_t *face,
hb_aat_layout_feature_type_t feature_type) hb_aat_layout_feature_type_t feature_type)
{ return face->table.feat->get_feature_name_id (feature_type); } {
return face->table.feat->get_feature_name_id (feature_type);
}
/** /**
* hb_aat_layout_feature_type_get_selectors: * hb_aat_layout_feature_type_get_selectors:

View File

@ -574,7 +574,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
set_cluster (out_info[i], cluster); set_cluster (out_info[i], cluster);
} }
void void
hb_buffer_t::delete_glyph () hb_buffer_t::delete_glyph (void)
{ {
/* The logic here is duplicated in hb_ot_hide_default_ignorables(). */ /* The logic here is duplicated in hb_ot_hide_default_ignorables(). */

View File

@ -54,17 +54,17 @@ private:
IDWriteFontFileStream *mFontFileStream; IDWriteFontFileStream *mFontFileStream;
public: public:
DWriteFontFileLoader (IDWriteFontFileStream *fontFileStream) DWriteFontFileLoader (IDWriteFontFileStream *fontFileStream)
{ { mFontFileStream = fontFileStream; }
mFontFileStream = fontFileStream;
}
// IUnknown interface // IUnknown interface
IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject) { return S_OK; } IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
IFACEMETHOD_ (ULONG, AddRef) () { return 1; } { return S_OK; }
IFACEMETHOD_ (ULONG, Release) () { return 1; } IFACEMETHOD_ (ULONG, AddRef) (void) { return 1; }
IFACEMETHOD_ (ULONG, Release) (void) { return 1; }
// IDWriteFontFileLoader methods // IDWriteFontFileLoader methods
virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey (void const* fontFileReferenceKey, virtual HRESULT STDMETHODCALLTYPE
CreateStreamFromKey (void const* fontFileReferenceKey,
uint32_t fontFileReferenceKeySize, uint32_t fontFileReferenceKeySize,
OUT IDWriteFontFileStream** fontFileStream) OUT IDWriteFontFileStream** fontFileStream)
{ {
@ -86,19 +86,20 @@ public:
} }
// IUnknown interface // IUnknown interface
IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject) { return S_OK; } IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
IFACEMETHOD_ (ULONG, AddRef) () { return 1; } { return S_OK; }
IFACEMETHOD_ (ULONG, Release) () { return 1; } IFACEMETHOD_ (ULONG, AddRef) (void) { return 1; }
IFACEMETHOD_ (ULONG, Release) (void) { return 1; }
// IDWriteFontFileStream methods // IDWriteFontFileStream methods
virtual HRESULT STDMETHODCALLTYPE ReadFileFragment (void const** fragmentStart, virtual HRESULT STDMETHODCALLTYPE
ReadFileFragment (void const** fragmentStart,
UINT64 fileOffset, UINT64 fileOffset,
UINT64 fragmentSize, UINT64 fragmentSize,
OUT void** fragmentContext) OUT void** fragmentContext)
{ {
// We are required to do bounds checking. // We are required to do bounds checking.
if (fileOffset + fragmentSize > mSize) if (fileOffset + fragmentSize > mSize) return E_FAIL;
return E_FAIL;
// truncate the 64 bit fileOffset to size_t sized index into mData // truncate the 64 bit fileOffset to size_t sized index into mData
size_t index = static_cast<size_t> (fileOffset); size_t index = static_cast<size_t> (fileOffset);
@ -109,18 +110,18 @@ public:
return S_OK; return S_OK;
} }
virtual void STDMETHODCALLTYPE ReleaseFileFragment (void* fragmentContext) { } virtual void STDMETHODCALLTYPE
ReleaseFileFragment (void* fragmentContext) {}
virtual HRESULT STDMETHODCALLTYPE GetFileSize (OUT UINT64* fileSize) virtual HRESULT STDMETHODCALLTYPE
GetFileSize (OUT UINT64* fileSize)
{ {
*fileSize = mSize; *fileSize = mSize;
return S_OK; return S_OK;
} }
virtual HRESULT STDMETHODCALLTYPE GetLastWriteTime (OUT UINT64* lastWriteTime) virtual HRESULT STDMETHODCALLTYPE
{ GetLastWriteTime (OUT UINT64* lastWriteTime) { return E_NOTIMPL; }
return E_NOTIMPL;
}
}; };
@ -147,16 +148,13 @@ _hb_directwrite_shaper_face_data_create (hb_face_t *face)
// TODO: factory and fontFileLoader should be cached separately // TODO: factory and fontFileLoader should be cached separately
IDWriteFactory* dwriteFactory; IDWriteFactory* dwriteFactory;
DWriteCreateFactory ( DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
DWRITE_FACTORY_TYPE_SHARED, (IUnknown**) &dwriteFactory);
__uuidof (IDWriteFactory),
(IUnknown**) &dwriteFactory
);
HRESULT hr; HRESULT hr;
hb_blob_t *blob = hb_face_reference_blob (face); hb_blob_t *blob = hb_face_reference_blob (face);
DWriteFontFileStream *fontFileStream = new DWriteFontFileStream ( DWriteFontFileStream *fontFileStream;
(uint8_t *) hb_blob_get_data (blob, nullptr), fontFileStream = new DWriteFontFileStream ((uint8_t *) hb_blob_get_data (blob, nullptr),
hb_blob_get_length (blob)); hb_blob_get_length (blob));
DWriteFontFileLoader *fontFileLoader = new DWriteFontFileLoader (fontFileStream); DWriteFontFileLoader *fontFileLoader = new DWriteFontFileLoader (fontFileStream);
@ -228,9 +226,7 @@ _hb_directwrite_shaper_face_data_destroy (hb_directwrite_face_data_t *data)
* shaper font data * shaper font data
*/ */
struct hb_directwrite_font_data_t struct hb_directwrite_font_data_t {};
{
};
hb_directwrite_font_data_t * hb_directwrite_font_data_t *
_hb_directwrite_shaper_font_data_create (hb_font_t *font) _hb_directwrite_shaper_font_data_create (hb_font_t *font)
@ -251,14 +247,14 @@ _hb_directwrite_shaper_font_data_destroy (hb_directwrite_font_data_t *data)
// Most of TextAnalysis is originally written by Bas Schouten for Mozilla project // Most of TextAnalysis is originally written by Bas Schouten for Mozilla project
// but now is relicensed to MIT for HarfBuzz use // but now is relicensed to MIT for HarfBuzz use
class TextAnalysis class TextAnalysis : public IDWriteTextAnalysisSource, public IDWriteTextAnalysisSink
: public IDWriteTextAnalysisSource, public IDWriteTextAnalysisSink
{ {
public: public:
IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject) { return S_OK; } IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
IFACEMETHOD_ (ULONG, AddRef) () { return 1; } { return S_OK; }
IFACEMETHOD_ (ULONG, Release) () { return 1; } IFACEMETHOD_ (ULONG, AddRef) (void) { return 1; }
IFACEMETHOD_ (ULONG, Release) (void) { return 1; }
// A single contiguous run of characters containing the same analysis // A single contiguous run of characters containing the same analysis
// results. // results.
@ -283,17 +279,11 @@ public:
}; };
public: public:
TextAnalysis (const wchar_t* text, TextAnalysis (const wchar_t* text, uint32_t textLength,
uint32_t textLength, const wchar_t* localeName, DWRITE_READING_DIRECTION readingDirection)
const wchar_t* localeName, : mText (text), mTextLength (textLength), mLocaleName (localeName),
DWRITE_READING_DIRECTION readingDirection) mReadingDirection (readingDirection), mCurrentRun (nullptr) {}
: mText (text) ~TextAnalysis (void)
, mTextLength (textLength)
, mLocaleName (localeName)
, mReadingDirection (readingDirection)
, mCurrentRun (nullptr) { };
~TextAnalysis ()
{ {
// delete runs, except mRunHead which is part of the TextAnalysis object // delete runs, except mRunHead which is part of the TextAnalysis object
for (Run *run = mRunHead.nextRun; run;) for (Run *run = mRunHead.nextRun; run;)
@ -304,8 +294,8 @@ public:
} }
} }
STDMETHODIMP GenerateResults (IDWriteTextAnalyzer* textAnalyzer, STDMETHODIMP
Run **runHead) GenerateResults (IDWriteTextAnalyzer* textAnalyzer, Run **runHead)
{ {
// Analyzes the text using the script analyzer and returns // Analyzes the text using the script analyzer and returns
// the result as a series of runs. // the result as a series of runs.
@ -330,7 +320,8 @@ public:
// IDWriteTextAnalysisSource implementation // IDWriteTextAnalysisSource implementation
IFACEMETHODIMP GetTextAtPosition (uint32_t textPosition, IFACEMETHODIMP
GetTextAtPosition (uint32_t textPosition,
OUT wchar_t const** textString, OUT wchar_t const** textString,
OUT uint32_t* textLength) OUT uint32_t* textLength)
{ {
@ -348,7 +339,8 @@ public:
return S_OK; return S_OK;
} }
IFACEMETHODIMP GetTextBeforePosition (uint32_t textPosition, IFACEMETHODIMP
GetTextBeforePosition (uint32_t textPosition,
OUT wchar_t const** textString, OUT wchar_t const** textString,
OUT uint32_t* textLength) OUT uint32_t* textLength)
{ {
@ -368,14 +360,11 @@ public:
} }
IFACEMETHODIMP_ (DWRITE_READING_DIRECTION) IFACEMETHODIMP_ (DWRITE_READING_DIRECTION)
GetParagraphReadingDirection () { return mReadingDirection; } GetParagraphReadingDirection (void) { return mReadingDirection; }
IFACEMETHODIMP GetLocaleName (uint32_t textPosition, IFACEMETHODIMP GetLocaleName (uint32_t textPosition, uint32_t* textLength,
uint32_t* textLength,
wchar_t const** localeName) wchar_t const** localeName)
{ { return S_OK; }
return S_OK;
}
IFACEMETHODIMP IFACEMETHODIMP
GetNumberSubstitution (uint32_t textPosition, GetNumberSubstitution (uint32_t textPosition,
@ -392,8 +381,7 @@ public:
// IDWriteTextAnalysisSink implementation // IDWriteTextAnalysisSink implementation
IFACEMETHODIMP IFACEMETHODIMP
SetScriptAnalysis (uint32_t textPosition, SetScriptAnalysis (uint32_t textPosition, uint32_t textLength,
uint32_t textLength,
DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis) DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis)
{ {
SetCurrentRun (textPosition); SetCurrentRun (textPosition);
@ -410,17 +398,17 @@ public:
IFACEMETHODIMP IFACEMETHODIMP
SetLineBreakpoints (uint32_t textPosition, SetLineBreakpoints (uint32_t textPosition,
uint32_t textLength, uint32_t textLength,
const DWRITE_LINE_BREAKPOINT* lineBreakpoints) { return S_OK; } const DWRITE_LINE_BREAKPOINT* lineBreakpoints)
{ return S_OK; }
IFACEMETHODIMP SetBidiLevel (uint32_t textPosition, IFACEMETHODIMP SetBidiLevel (uint32_t textPosition, uint32_t textLength,
uint32_t textLength, uint8_t explicitLevel, uint8_t resolvedLevel)
uint8_t explicitLevel, { return S_OK; }
uint8_t resolvedLevel) { return S_OK; }
IFACEMETHODIMP IFACEMETHODIMP
SetNumberSubstitution (uint32_t textPosition, SetNumberSubstitution (uint32_t textPosition, uint32_t textLength,
uint32_t textLength, IDWriteNumberSubstitution* numberSubstitution)
IDWriteNumberSubstitution* numberSubstitution) { return S_OK; } { return S_OK; }
protected: protected:
Run *FetchNextRun (IN OUT uint32_t* textLength) Run *FetchNextRun (IN OUT uint32_t* textLength)
@ -580,7 +568,8 @@ _hb_directwrite_shape_full (hb_shape_plan_t *shape_plan,
// TODO: Handle TEST_DISABLE_OPTIONAL_LIGATURES // TODO: Handle TEST_DISABLE_OPTIONAL_LIGATURES
DWRITE_READING_DIRECTION readingDirection = buffer->props.direction ? DWRITE_READING_DIRECTION readingDirection;
readingDirection = buffer->props.direction ?
DWRITE_READING_DIRECTION_RIGHT_TO_LEFT : DWRITE_READING_DIRECTION_RIGHT_TO_LEFT :
DWRITE_READING_DIRECTION_LEFT_TO_RIGHT; DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
@ -611,10 +600,8 @@ _hb_directwrite_shape_full (hb_shape_plan_t *shape_plan,
const wchar_t localeName[20] = {0}; const wchar_t localeName[20] = {0};
if (buffer->props.language != nullptr) if (buffer->props.language != nullptr)
{
mbstowcs ((wchar_t*) localeName, mbstowcs ((wchar_t*) localeName,
hb_language_to_string (buffer->props.language), 20); hb_language_to_string (buffer->props.language), 20);
}
// TODO: it does work but doesn't care about ranges // TODO: it does work but doesn't care about ranges
DWRITE_TYPOGRAPHIC_FEATURES typographic_features; DWRITE_TYPOGRAPHIC_FEATURES typographic_features;
@ -629,23 +616,25 @@ _hb_directwrite_shape_full (hb_shape_plan_t *shape_plan,
typographic_features.features[i].parameter = features[i].value; typographic_features.features[i].parameter = features[i].value;
} }
} }
const DWRITE_TYPOGRAPHIC_FEATURES* dwFeatures = const DWRITE_TYPOGRAPHIC_FEATURES* dwFeatures;
(const DWRITE_TYPOGRAPHIC_FEATURES*) &typographic_features; dwFeatures = (const DWRITE_TYPOGRAPHIC_FEATURES*) &typographic_features;
const uint32_t featureRangeLengths[] = { textLength }; const uint32_t featureRangeLengths[] = { textLength };
// //
uint16_t* clusterMap = new uint16_t[textLength]; uint16_t* clusterMap;
DWRITE_SHAPING_TEXT_PROPERTIES* textProperties = clusterMap = new uint16_t[textLength];
new DWRITE_SHAPING_TEXT_PROPERTIES[textLength]; DWRITE_SHAPING_TEXT_PROPERTIES* textProperties;
textProperties = new DWRITE_SHAPING_TEXT_PROPERTIES[textLength];
retry_getglyphs: retry_getglyphs:
uint16_t* glyphIndices = new uint16_t[maxGlyphCount]; uint16_t* glyphIndices = new uint16_t[maxGlyphCount];
DWRITE_SHAPING_GLYPH_PROPERTIES* glyphProperties = DWRITE_SHAPING_GLYPH_PROPERTIES* glyphProperties;
new DWRITE_SHAPING_GLYPH_PROPERTIES[maxGlyphCount]; glyphProperties = new DWRITE_SHAPING_GLYPH_PROPERTIES[maxGlyphCount];
hr = analyzer->GetGlyphs (textString, textLength, fontFace, false, hr = analyzer->GetGlyphs (textString, textLength, fontFace, false,
isRightToLeft, &runHead->mScript, localeName, nullptr, &dwFeatures, isRightToLeft, &runHead->mScript, localeName,
featureRangeLengths, 1, maxGlyphCount, clusterMap, textProperties, glyphIndices, nullptr, &dwFeatures, featureRangeLengths, 1,
glyphProperties, &glyphCount); maxGlyphCount, clusterMap, textProperties,
glyphIndices, glyphProperties, &glyphCount);
if (unlikely (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER))) if (unlikely (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER)))
{ {
@ -675,17 +664,15 @@ retry_getglyphs:
#undef ALLOCATE_ARRAY #undef ALLOCATE_ARRAY
int fontEmSize = font->face->get_upem (); int fontEmSize = font->face->get_upem ();
if (fontEmSize < 0) if (fontEmSize < 0) fontEmSize = -fontEmSize;
fontEmSize = -fontEmSize;
if (fontEmSize < 0) if (fontEmSize < 0) fontEmSize = -fontEmSize;
fontEmSize = -fontEmSize;
double x_mult = (double) font->x_scale / fontEmSize; double x_mult = (double) font->x_scale / fontEmSize;
double y_mult = (double) font->y_scale / fontEmSize; double y_mult = (double) font->y_scale / fontEmSize;
hr = analyzer->GetGlyphPlacements (textString, hr = analyzer->GetGlyphPlacements (textString, clusterMap, textProperties,
clusterMap, textProperties, textLength, glyphIndices, textLength, glyphIndices, glyphProperties,
glyphProperties, glyphCount, fontFace, fontEmSize, glyphCount, fontFace, fontEmSize,
false, isRightToLeft, &runHead->mScript, localeName, false, isRightToLeft, &runHead->mScript, localeName,
&dwFeatures, featureRangeLengths, 1, &dwFeatures, featureRangeLengths, 1,
glyphAdvances, glyphOffsets); glyphAdvances, glyphOffsets);
@ -698,12 +685,12 @@ retry_getglyphs:
if (analyzer1 && lineWidth) if (analyzer1 && lineWidth)
{ {
DWRITE_JUSTIFICATION_OPPORTUNITY* justificationOpportunities = DWRITE_JUSTIFICATION_OPPORTUNITY* justificationOpportunities =
new DWRITE_JUSTIFICATION_OPPORTUNITY[maxGlyphCount]; new DWRITE_JUSTIFICATION_OPPORTUNITY[maxGlyphCount];
hr = analyzer1->GetJustificationOpportunities (fontFace, fontEmSize, hr = analyzer1->GetJustificationOpportunities (fontFace, fontEmSize, runHead->mScript,
runHead->mScript, textLength, glyphCount, textString, clusterMap, textLength, glyphCount, textString,
glyphProperties, justificationOpportunities); clusterMap, glyphProperties,
justificationOpportunities);
if (FAILED (hr)) if (FAILED (hr))
FAIL ("Analyzer failed to get justification opportunities."); FAIL ("Analyzer failed to get justification opportunities.");
@ -711,15 +698,14 @@ retry_getglyphs:
float* justifiedGlyphAdvances = new float[maxGlyphCount]; float* justifiedGlyphAdvances = new float[maxGlyphCount];
DWRITE_GLYPH_OFFSET* justifiedGlyphOffsets = new DWRITE_GLYPH_OFFSET[glyphCount]; DWRITE_GLYPH_OFFSET* justifiedGlyphOffsets = new DWRITE_GLYPH_OFFSET[glyphCount];
hr = analyzer1->JustifyGlyphAdvances (lineWidth, glyphCount, justificationOpportunities, hr = analyzer1->JustifyGlyphAdvances (lineWidth, glyphCount, justificationOpportunities,
glyphAdvances, glyphOffsets, justifiedGlyphAdvances, justifiedGlyphOffsets); glyphAdvances, glyphOffsets, justifiedGlyphAdvances,
justifiedGlyphOffsets);
if (FAILED (hr)) if (FAILED (hr)) FAIL ("Analyzer failed to get justify glyph advances.");
FAIL ("Analyzer failed to get justified glyph advances.");
DWRITE_SCRIPT_PROPERTIES scriptProperties; DWRITE_SCRIPT_PROPERTIES scriptProperties;
hr = analyzer1->GetScriptProperties (runHead->mScript, &scriptProperties); hr = analyzer1->GetScriptProperties (runHead->mScript, &scriptProperties);
if (FAILED (hr)) if (FAILED (hr)) FAIL ("Analyzer failed to get script properties.");
FAIL ("Analyzer failed to get script properties.");
uint32_t justificationCharacter = scriptProperties.justificationCharacter; uint32_t justificationCharacter = scriptProperties.justificationCharacter;
// if a script justificationCharacter is not space, it can have GetJustifiedGlyphs // if a script justificationCharacter is not space, it can have GetJustifiedGlyphs
@ -729,13 +715,14 @@ retry_getglyphs:
retry_getjustifiedglyphs: retry_getjustifiedglyphs:
uint16_t* modifiedGlyphIndices = new uint16_t[maxGlyphCount]; uint16_t* modifiedGlyphIndices = new uint16_t[maxGlyphCount];
float* modifiedGlyphAdvances = new float[maxGlyphCount]; float* modifiedGlyphAdvances = new float[maxGlyphCount];
DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets = DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets = new DWRITE_GLYPH_OFFSET[maxGlyphCount];
new DWRITE_GLYPH_OFFSET[maxGlyphCount];
uint32_t actualGlyphsCount; uint32_t actualGlyphsCount;
hr = analyzer1->GetJustifiedGlyphs (fontFace, fontEmSize, runHead->mScript, hr = analyzer1->GetJustifiedGlyphs (fontFace, fontEmSize, runHead->mScript,
textLength, glyphCount, maxGlyphCount, clusterMap, glyphIndices, textLength, glyphCount, maxGlyphCount,
glyphAdvances, justifiedGlyphAdvances, justifiedGlyphOffsets, clusterMap, glyphIndices, glyphAdvances,
glyphProperties, &actualGlyphsCount, modifiedClusterMap, modifiedGlyphIndices, justifiedGlyphAdvances, justifiedGlyphOffsets,
glyphProperties, &actualGlyphsCount,
modifiedClusterMap, modifiedGlyphIndices,
modifiedGlyphAdvances, modifiedGlyphOffsets); modifiedGlyphAdvances, modifiedGlyphOffsets);
if (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER)) if (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER))
@ -776,7 +763,6 @@ retry_getglyphs:
} }
delete [] justificationOpportunities; delete [] justificationOpportunities;
} }
/* Ok, we've got everything we need, now compose output buffer, /* Ok, we've got everything we need, now compose output buffer,
@ -826,13 +812,11 @@ retry_getglyphs:
/* TODO vertical */ /* TODO vertical */
pos->x_advance = x_mult * (int32_t) info->mask; pos->x_advance = x_mult * (int32_t) info->mask;
pos->x_offset = pos->x_offset = x_mult * (isRightToLeft ? -info->var1.i32 : info->var1.i32);
x_mult * (isRightToLeft ? -info->var1.i32 : info->var1.i32);
pos->y_offset = y_mult * info->var2.i32; pos->y_offset = y_mult * info->var2.i32;
} }
if (isRightToLeft) if (isRightToLeft) hb_buffer_reverse (buffer);
hb_buffer_reverse (buffer);
delete [] clusterMap; delete [] clusterMap;
delete [] glyphIndices; delete [] glyphIndices;
@ -871,8 +855,9 @@ hb_directwrite_shape_experimental_width (hb_font_t *font,
float width) float width)
{ {
static const char *shapers = "directwrite"; static const char *shapers = "directwrite";
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, hb_shape_plan_t *shape_plan;
&buffer->props, features, num_features, &shapers); shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props,
features, num_features, &shapers);
hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer, hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer,
features, num_features, width); features, num_features, width);

View File

@ -619,8 +619,7 @@ struct hb_array_t
return not_found; return not_found;
} }
template <typename T> template <typename T>
inline const Type *lsearch (const T &x, inline const Type *lsearch (const T &x, const Type *not_found = nullptr) const
const Type *not_found = nullptr) const
{ {
unsigned int count = len; unsigned int count = len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -799,7 +798,7 @@ struct hb_vector_size_t
{ return process<HbOpAnd> (o); } { return process<HbOpAnd> (o); }
inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const
{ return process<HbOpXor> (o); } { return process<HbOpXor> (o); }
inline hb_vector_size_t operator ~ () const inline hb_vector_size_t operator ~ (void) const
{ {
hb_vector_size_t r; hb_vector_size_t r;
#if HB_VECTOR_SIZE && 0 #if HB_VECTOR_SIZE && 0

View File

@ -156,14 +156,10 @@ struct hb_map_t
return items[i].key == key ? items[i].value : INVALID; return items[i].key == key ? items[i].value : INVALID;
} }
inline void del (hb_codepoint_t key) inline void del (hb_codepoint_t key) { set (key, INVALID); }
{
set (key, INVALID);
}
inline bool has (hb_codepoint_t key) const inline bool has (hb_codepoint_t key) const
{ { return get (key) != INVALID; }
return get (key) != INVALID;
}
inline hb_codepoint_t operator [] (unsigned int key) const inline hb_codepoint_t operator [] (unsigned int key) const
{ return get (key); } { return get (key); }
@ -176,15 +172,9 @@ struct hb_map_t
population = occupancy = 0; population = occupancy = 0;
} }
inline bool is_empty (void) const inline bool is_empty (void) const { return population == 0; }
{
return population == 0;
}
inline unsigned int get_population () const inline unsigned int get_population (void) const { return population; }
{
return population;
}
protected: protected:

View File

@ -847,7 +847,7 @@ struct cmap
struct subset_plan struct subset_plan
{ {
inline size_t final_size () const inline size_t final_size (void) const
{ {
return 4 // header return 4 // header
+ 8 * 3 // 3 EncodingRecord + 8 * 3 // 3 EncodingRecord

View File

@ -505,7 +505,7 @@ struct CBDT
return hb_blob_get_empty (); return hb_blob_get_empty ();
} }
inline bool has_data () const { return cbdt.get_length (); } inline bool has_data (void) const { return cbdt.get_length (); }
private: private:
hb_blob_ptr_t<CBLC> cblc; hb_blob_ptr_t<CBLC> cblc;

View File

@ -117,8 +117,8 @@ struct CPAL
inline unsigned int get_size (void) const inline unsigned int get_size (void) const
{ return min_size + numPalettes * sizeof (colorRecordIndicesZ[0]); } { return min_size + numPalettes * sizeof (colorRecordIndicesZ[0]); }
inline unsigned int get_palette_count () const { return numPalettes; } inline unsigned int get_palette_count (void) const { return numPalettes; }
inline unsigned int get_color_count () const { return numColors; } inline unsigned int get_color_count (void) const { return numColors; }
inline hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const inline hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const
{ return v1 ().get_palette_flags (this, palette_index, numPalettes); } { return v1 ().get_palette_flags (this, palette_index, numPalettes); }

View File

@ -144,15 +144,9 @@ struct sbix
num_glyphs = face->get_num_glyphs (); num_glyphs = face->get_num_glyphs ();
} }
inline void fini (void) inline void fini (void) { table.destroy (); }
{
table.destroy ();
}
inline bool has_data () const inline bool has_data (void) const { return table->has_data (); }
{
return table->has_data ();
}
inline bool get_extents (hb_font_t *font, inline bool get_extents (hb_font_t *font,
hb_codepoint_t glyph, hb_codepoint_t glyph,

View File

@ -80,14 +80,9 @@ struct SVG
struct accelerator_t struct accelerator_t
{ {
inline void init (hb_face_t *face) inline void init (hb_face_t *face)
{ { table = hb_sanitize_context_t().reference_table<SVG> (face); }
table = hb_sanitize_context_t().reference_table<SVG> (face);
}
inline void fini (void) inline void fini (void) { table.destroy (); }
{
table.destroy ();
}
inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const
{ {
@ -95,16 +90,14 @@ struct SVG
table->svgDocEntries); table->svgDocEntries);
} }
inline bool has_data () const { return table->has_data (); } inline bool has_data (void) const { return table->has_data (); }
private: private:
hb_blob_ptr_t<SVG> table; hb_blob_ptr_t<SVG> table;
}; };
inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const
{ { return (this+svgDocEntries).bsearch (glyph_id); }
return (this+svgDocEntries).bsearch (glyph_id);
}
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {

View File

@ -177,7 +177,7 @@ struct glyf
const char *glyph_end; const char *glyph_end;
const CompositeGlyphHeader *current; const CompositeGlyphHeader *current;
inline bool move_to_next () inline bool move_to_next (void)
{ {
if (current->flags & CompositeGlyphHeader::MORE_COMPONENTS) if (current->flags & CompositeGlyphHeader::MORE_COMPONENTS)
{ {

View File

@ -56,10 +56,8 @@ struct DeviceRecord
this->subset_plan = subset_plan; this->subset_plan = subset_plan;
} }
inline unsigned int len () const inline unsigned int len (void) const
{ { return this->subset_plan->glyphs.len; }
return this->subset_plan->glyphs.len;
}
inline const HBUINT8* operator [] (unsigned int i) const inline const HBUINT8* operator [] (unsigned int i) const
{ {

View File

@ -44,7 +44,7 @@ namespace OT {
struct BaseCoordFormat1 struct BaseCoordFormat1
{ {
inline hb_position_t get_coord () const { return coordinate; } inline hb_position_t get_coord (void) const { return coordinate; }
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -61,7 +61,7 @@ struct BaseCoordFormat1
struct BaseCoordFormat2 struct BaseCoordFormat2
{ {
inline hb_position_t get_coord () const inline hb_position_t get_coord (void) const
{ {
/* TODO */ /* TODO */
return coordinate; return coordinate;
@ -280,7 +280,7 @@ struct BaseLangSysRecord
0; 0;
} }
inline const MinMax &get_min_max () const inline const MinMax &get_min_max (void) const
{ return this+minMax; } { return this+minMax; }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
@ -315,8 +315,7 @@ struct BaseScript
inline const BaseCoord &get_base_coord (int baseline_tag_index) const inline const BaseCoord &get_base_coord (int baseline_tag_index) const
{ return (this+baseValues).get_base_coord (baseline_tag_index); } { return (this+baseValues).get_base_coord (baseline_tag_index); }
inline bool is_empty () const inline bool is_empty (void) const { return !baseValues; }
{ return !baseValues; }
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -470,7 +469,7 @@ struct BASE
inline const Axis &get_axis (hb_direction_t direction) const inline const Axis &get_axis (hb_direction_t direction) const
{ return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; } { return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; }
inline const VariationStore &get_var_store () const inline const VariationStore &get_var_store (void) const
{ return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; } { return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; }
inline bool get_baseline (hb_font_t *font, inline bool get_baseline (hb_font_t *font,

View File

@ -1,5 +1,6 @@
/* /*
* Copyright © 2011,2012 Google, Inc. * Copyright © 2011,2012 Google, Inc.
* Copyright © 2018 Ebrahim Byagowi
* *
* This is part of HarfBuzz, a text shaping library. * This is part of HarfBuzz, a text shaping library.
* *
@ -93,13 +94,13 @@ struct OS2
{ {
enum { tableTag = HB_OT_TAG_OS2 }; enum { tableTag = HB_OT_TAG_OS2 };
inline bool has_data () const { return this != &Null (OS2); } inline bool has_data (void) const { return this != &Null (OS2); }
inline const OS2V1Tail &v1 (void) const { return version >= 1 ? v1X : Null (OS2V1Tail); } inline const OS2V1Tail &v1 (void) const { return version >= 1 ? v1X : Null (OS2V1Tail); }
inline const OS2V2Tail &v2 (void) const { return version >= 2 ? v2X : Null (OS2V2Tail); } inline const OS2V2Tail &v2 (void) const { return version >= 2 ? v2X : Null (OS2V2Tail); }
inline const OS2V5Tail &v5 (void) const { return version >= 5 ? v5X : Null (OS2V5Tail); } inline const OS2V5Tail &v5 (void) const { return version >= 5 ? v5X : Null (OS2V5Tail); }
enum fs_selection_flag_t { enum selection_flag_t {
ITALIC = 1u<<0, ITALIC = 1u<<0,
UNDERSCORE = 1u<<1, UNDERSCORE = 1u<<1,
NEGATIVE = 1u<<2, NEGATIVE = 1u<<2,
@ -128,7 +129,7 @@ struct OS2
FWIDTH_ULTRA_EXPANDED = 9 /* 200% */ FWIDTH_ULTRA_EXPANDED = 9 /* 200% */
}; };
inline float get_width () const inline float get_width (void) const
{ {
switch (usWidthClass) { switch (usWidthClass) {
case FWIDTH_ULTRA_CONDENSED:return 50.f; case FWIDTH_ULTRA_CONDENSED:return 50.f;
@ -214,12 +215,8 @@ struct OS2
}; };
// https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681 // https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681
inline font_page_t get_font_page () const inline font_page_t get_font_page (void) const
{ { return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); }
if (version != 0)
return (font_page_t) 0;
return (font_page_t) (fsSelection & 0xFF00);
}
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {