summaryrefslogtreecommitdiff
path: root/vcl/generic
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-04-27 18:18:51 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-04-29 12:45:40 +0200
commit2e302f18efe8f2e5f3c17d7734a8adcb670fbe42 (patch)
tree89047a802d414432e5f3b0e65e90e0f3b491907c /vcl/generic
parent8f748ce03b724ea67738054bc32325fdf950fc0c (diff)
[harfbuzz] Follow variable naming conventions
Not that I'm a fan of Hungarian notation, but for the sake of consistency. Fix some placement of opening braces along the way. Change-Id: Id6ea758fd438a4040e7451430a0f3a166efdec43
Diffstat (limited to 'vcl/generic')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx146
1 files changed, 75 insertions, 71 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index b4137bbd80f7..856f8b43d310 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -157,7 +157,7 @@ static bool needNextCode(sal_Unicode cChar)
}
#if ENABLE_HARFBUZZ
-static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* userData)
+static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData)
{
char pTagName[5];
pTagName[0] = (char)(nTableTag >> 24);
@@ -166,9 +166,9 @@ static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* us
pTagName[3] = (char)(nTableTag);
pTagName[4] = 0;
- ServerFont* rFont = (ServerFont*) userData;
+ ServerFont* pFont = (ServerFont*) pUserData;
sal_uLong nLength;
- const unsigned char* pBuffer = rFont->GetTable(pTagName, &nLength);
+ const unsigned char* pBuffer = pFont->GetTable(pTagName, &nLength);
hb_blob_t* pBlob = NULL;
if (pBuffer != NULL)
@@ -177,61 +177,61 @@ static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* us
return pBlob;
}
-static hb_bool_t getFontGlyph(hb_font_t* /*font*/, void* fontData,
+static hb_bool_t getFontGlyph(hb_font_t* /*font*/, void* pFontData,
hb_codepoint_t ch, hb_codepoint_t vs,
hb_codepoint_t* nGlyphIndex,
- void* /*userData*/)
+ void* /*pUserData*/)
{
- ServerFont* rFont = (ServerFont*) fontData;
+ ServerFont* pFont = (ServerFont*) pFontData;
*nGlyphIndex = 0;
if (vs)
- *nGlyphIndex = rFont->GetRawGlyphIndex(ch /*, vs*/); // XXX handle variation selectors
+ *nGlyphIndex = pFont->GetRawGlyphIndex(ch /*, vs*/); // XXX handle variation selectors
if (*nGlyphIndex == 0)
- *nGlyphIndex = rFont->GetRawGlyphIndex(ch);
+ *nGlyphIndex = pFont->GetRawGlyphIndex(ch);
return *nGlyphIndex != 0;
}
-static hb_position_t getGlyphAdvanceH(hb_font_t* /*font*/, void* fontData,
+static hb_position_t getGlyphAdvanceH(hb_font_t* /*font*/, void* pFontData,
hb_codepoint_t nGlyphIndex,
- void* /*userData*/)
+ void* /*pUserData*/)
{
- ServerFont* rFont = (ServerFont*) fontData;
- const GlyphMetric& rGM = rFont->GetGlyphMetric(nGlyphIndex);
+ ServerFont* pFont = (ServerFont*) pFontData;
+ const GlyphMetric& rGM = pFont->GetGlyphMetric(nGlyphIndex);
return rGM.GetCharWidth() << 6;
}
-static hb_position_t getGlyphAdvanceV(hb_font_t* /*font*/, void* /*fontData*/,
+static hb_position_t getGlyphAdvanceV(hb_font_t* /*font*/, void* /*pFontData*/,
hb_codepoint_t /*nGlyphIndex*/,
- void* /*userData*/)
+ void* /*pUserData*/)
{
// XXX: vertical metrics
return 0;
}
-static hb_bool_t getGlyphOriginH(hb_font_t* /*font*/, void* /*fontData*/,
+static hb_bool_t getGlyphOriginH(hb_font_t* /*font*/, void* /*pFontData*/,
hb_codepoint_t /*nGlyphIndex*/,
hb_position_t* /*x*/, hb_position_t* /*y*/,
- void* /*userData*/)
+ void* /*pUserData*/)
{
// the horizontal origin is always (0, 0)
return true;
}
-static hb_bool_t getGlyphOriginV(hb_font_t* /*font*/, void* /*fontData*/,
+static hb_bool_t getGlyphOriginV(hb_font_t* /*font*/, void* /*pFontData*/,
hb_codepoint_t /*nGlyphIndex*/,
hb_position_t* /*x*/, hb_position_t* /*y*/,
- void* /*userData*/)
+ void* /*pUserData*/)
{
// XXX: vertical origin
return true;
}
-static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* fontData,
+static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* pFontData,
hb_codepoint_t nGlyphIndex1, hb_codepoint_t nGlyphIndex2,
- void* /*userData*/)
+ void* /*pUserData*/)
{
// This callback is for old style 'kern' table, GPOS kerning is handled by HarfBuzz directly
@@ -241,8 +241,8 @@ static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* fontData,
// other implementattions should be removed, don't seem to be used
// anywhere.
- ServerFont* rFont = (ServerFont*) fontData;
- FT_Face aFace = rFont->GetFtFace();
+ ServerFont* pFont = (ServerFont*) pFontData;
+ FT_Face aFace = pFont->GetFtFace();
FT_Error error;
FT_Vector kerning;
@@ -257,48 +257,52 @@ static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* fontData,
return ret;
}
-static hb_position_t getGlyphKerningV(hb_font_t* /*font*/, void* /*fontData*/,
+static hb_position_t getGlyphKerningV(hb_font_t* /*font*/, void* /*pFontData*/,
hb_codepoint_t /*nGlyphIndex1*/, hb_codepoint_t /*nGlyphIndex2*/,
- void* /*userData*/)
+ void* /*pUserData*/)
{
// XXX vertical kerning
return 0;
}
-static hb_bool_t getGlyphExtents(hb_font_t* /*font*/, void* fontData,
+static hb_bool_t getGlyphExtents(hb_font_t* /*font*/, void* pFontData,
hb_codepoint_t nGlyphIndex,
- hb_glyph_extents_t* extents,
- void* /*userData*/)
+ hb_glyph_extents_t* pExtents,
+ void* /*pUserData*/)
{
- ServerFont* rFont = (ServerFont*) fontData;
- FT_Face aFace = rFont->GetFtFace();
+ ServerFont* pFont = (ServerFont*) pFontData;
+ FT_Face aFace = pFont->GetFtFace();
FT_Error error;
error = FT_Load_Glyph(aFace, nGlyphIndex, FT_LOAD_DEFAULT);
- if (!error) {
- extents->x_bearing = aFace->glyph->metrics.horiBearingX;
- extents->y_bearing = aFace->glyph->metrics.horiBearingY;
- extents->width = aFace->glyph->metrics.width;
- extents->height = -aFace->glyph->metrics.height;
+ if (!error)
+ {
+ pExtents->x_bearing = aFace->glyph->metrics.horiBearingX;
+ pExtents->y_bearing = aFace->glyph->metrics.horiBearingY;
+ pExtents->width = aFace->glyph->metrics.width;
+ pExtents->height = -aFace->glyph->metrics.height;
}
return !error;
}
-static hb_bool_t getGlyphContourPoint(hb_font_t* /*font*/, void* fontData,
+static hb_bool_t getGlyphContourPoint(hb_font_t* /*font*/, void* pFontData,
hb_codepoint_t nGlyphIndex, unsigned int nPointIndex,
hb_position_t *x, hb_position_t *y,
- void* /*userData*/)
+ void* /*pUserData*/)
{
- ServerFont* rFont = (ServerFont*) fontData;
- FT_Face aFace = rFont->GetFtFace();
+ ServerFont* pFont = (ServerFont*) pFontData;
+ FT_Face aFace = pFont->GetFtFace();
FT_Error error;
bool ret = false;
error = FT_Load_Glyph(aFace, nGlyphIndex, FT_LOAD_DEFAULT);
- if (!error) {
- if (aFace->glyph->format == FT_GLYPH_FORMAT_OUTLINE) {
- if (nPointIndex < (unsigned int) aFace->glyph->outline.n_points) {
+ if (!error)
+ {
+ if (aFace->glyph->format == FT_GLYPH_FORMAT_OUTLINE)
+ {
+ if (nPointIndex < (unsigned int) aFace->glyph->outline.n_points)
+ {
*x = aFace->glyph->outline.points[nPointIndex].x;
*y = aFace->glyph->outline.points[nPointIndex].y;
ret = true;
@@ -330,7 +334,7 @@ class HbLayoutEngine : public ServerFontLayoutEngine
{
private:
UScriptCode meScriptCode;
- hb_face_t* maHbFace;
+ hb_face_t* mpHbFace;
int fUnitsPerEM;
public:
@@ -342,20 +346,20 @@ public:
HbLayoutEngine::HbLayoutEngine(ServerFont& rServerFont)
: meScriptCode(USCRIPT_INVALID_CODE),
- maHbFace(NULL),
+ mpHbFace(NULL),
fUnitsPerEM(0)
{
FT_Face aFtFace = rServerFont.GetFtFace();
fUnitsPerEM = rServerFont.GetEmUnits();
- maHbFace = hb_face_create_for_tables(getFontTable, &rServerFont, NULL);
- hb_face_set_index(maHbFace, aFtFace->face_index);
- hb_face_set_upem(maHbFace, fUnitsPerEM);
+ mpHbFace = hb_face_create_for_tables(getFontTable, &rServerFont, NULL);
+ hb_face_set_index(mpHbFace, aFtFace->face_index);
+ hb_face_set_upem(mpHbFace, fUnitsPerEM);
}
HbLayoutEngine::~HbLayoutEngine()
{
- hb_face_destroy(maHbFace);
+ hb_face_destroy(mpHbFace);
}
bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
@@ -363,12 +367,12 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
ServerFont& rFont = rLayout.GetServerFont();
FT_Face aFtFace = rFont.GetFtFace();
- hb_font_t *aHbFont = hb_font_create(maHbFace);
- hb_font_set_funcs(aHbFont, getFontFuncs(), &rFont, NULL);
- hb_font_set_scale(aHbFont,
+ hb_font_t *pHbFont = hb_font_create(mpHbFace);
+ hb_font_set_funcs(pHbFont, getFontFuncs(), &rFont, NULL);
+ hb_font_set_scale(pHbFont,
((uint64_t) aFtFace->size->metrics.x_scale * (uint64_t) fUnitsPerEM) >> 16,
((uint64_t) aFtFace->size->metrics.y_scale * (uint64_t) fUnitsPerEM) >> 16);
- hb_font_set_ppem(aHbFont, aFtFace->size->metrics.x_ppem, aFtFace->size->metrics.y_ppem);
+ hb_font_set_ppem(pHbFont, aFtFace->size->metrics.x_ppem, aFtFace->size->metrics.y_ppem);
// allocate temporary arrays, note: round to even
int nGlyphCapacity = (3 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos) | 15) + 1;
@@ -409,21 +413,21 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
LanguageTag aLangTag(rArgs.meLanguage);
OString sLanguage = OUStringToOString(aLangTag.getLanguage(), RTL_TEXTENCODING_UTF8);
- hb_buffer_t *aHbBuffer = hb_buffer_create();
- hb_buffer_set_direction(aHbBuffer, bRightToLeft ? HB_DIRECTION_RTL: HB_DIRECTION_LTR);
- hb_buffer_set_script(aHbBuffer, hb_icu_script_to_script(eScriptCode));
- hb_buffer_set_language(aHbBuffer, hb_language_from_string(sLanguage.getStr(), -1));
- hb_buffer_add_utf16(aHbBuffer, rArgs.mpStr, nRunLen, nMinRunPos, nRunLen);
- hb_shape(aHbFont, aHbBuffer, NULL, 0);
+ hb_buffer_t *pHbBuffer = hb_buffer_create();
+ hb_buffer_set_direction(pHbBuffer, bRightToLeft ? HB_DIRECTION_RTL: HB_DIRECTION_LTR);
+ hb_buffer_set_script(pHbBuffer, hb_icu_script_to_script(eScriptCode));
+ hb_buffer_set_language(pHbBuffer, hb_language_from_string(sLanguage.getStr(), -1));
+ hb_buffer_add_utf16(pHbBuffer, rArgs.mpStr, nRunLen, nMinRunPos, nRunLen);
+ hb_shape(pHbFont, pHbBuffer, NULL, 0);
- int nRunGlyphCount = hb_buffer_get_length(aHbBuffer);
- hb_glyph_info_t *aHbGlyphInfos = hb_buffer_get_glyph_infos(aHbBuffer, NULL);
- hb_glyph_position_t *aHbPositions = hb_buffer_get_glyph_positions(aHbBuffer, NULL);
+ int nRunGlyphCount = hb_buffer_get_length(pHbBuffer);
+ hb_glyph_info_t *pHbGlyphInfos = hb_buffer_get_glyph_infos(pHbBuffer, NULL);
+ hb_glyph_position_t *pHbPositions = hb_buffer_get_glyph_positions(pHbBuffer, NULL);
int32_t nLastCluster = -1;
for (int i = 0; i < nRunGlyphCount; ++i) {
- int32_t nGlyphIndex = aHbGlyphInfos[i].codepoint;
- int32_t nCluster = aHbGlyphInfos[i].cluster;
+ int32_t nGlyphIndex = pHbGlyphInfos[i].codepoint;
+ int32_t nCluster = pHbGlyphInfos[i].cluster;
int32_t nCharPos = nCluster;
// if needed request glyph fallback by updating LayoutArgs
@@ -460,13 +464,13 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
if (bInCluster)
nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
- if (hb_ot_layout_get_glyph_class(maHbFace, nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+ if (hb_ot_layout_get_glyph_class(mpHbFace, nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
nGlyphFlags |= GlyphItem::IS_DIACRITIC;
- int32_t nXOffset = aHbPositions[i].x_offset >> 6;
- int32_t nYOffset = aHbPositions[i].y_offset >> 6;
- int32_t nXAdvance = aHbPositions[i].x_advance >> 6;
- int32_t nYAdvance = aHbPositions[i].y_advance >> 6;
+ int32_t nXOffset = pHbPositions[i].x_offset >> 6;
+ int32_t nYOffset = pHbPositions[i].y_offset >> 6;
+ int32_t nXAdvance = pHbPositions[i].x_advance >> 6;
+ int32_t nYAdvance = pHbPositions[i].y_advance >> 6;
Point aNewPos = Point(aCurrPos.X() + nXOffset, -(aCurrPos.Y() + nYOffset));
@@ -479,10 +483,10 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
aCurrPos.Y() += nYAdvance;
}
- hb_buffer_destroy(aHbBuffer);
+ hb_buffer_destroy(pHbBuffer);
}
- hb_font_destroy(aHbFont);
+ hb_font_destroy(pHbFont);
// sort glyphs in visual order
// and then in logical order (e.g. diacritics after cluster start)
@@ -1039,7 +1043,7 @@ bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
sal_UCS4 aChar = rArgs.mpStr[ nCharPos ];
nGlyphIndex = rFont.FixupGlyphIndex( nGlyphIndex, aChar );
- // #i99367# HACK: try to detect all diacritics
+ // i#99367# HACK: try to detect all diacritics
if( aChar>=0x0300 && aChar<0x2100 )
bDiacritic = IsDiacritic( aChar );
}
@@ -1051,7 +1055,7 @@ bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
int nNewWidth = nGlyphWidth;
if( nGlyphWidth <= 0 )
bDiacritic |= true;
- // #i99367# force all diacritics to zero width
+ // i#99367# force all diacritics to zero width
// TODO: we need mnOrigWidth/mnLogicWidth/mnNewWidth
else if( bDiacritic )
nGlyphWidth = nNewWidth = 0;