~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
935
935
    if (error)
936
936
        return 0;
937
937
    stream = (HB_Stream)malloc(sizeof(HB_StreamRec));
 
938
    if (!stream)
 
939
        return 0;
938
940
    stream->base = (HB_Byte*)malloc(length);
 
941
    if (!stream->base) {
 
942
        free(stream);
 
943
        return 0;
 
944
    }
939
945
    error = tableFunc(font, tag, stream->base, &length);
940
946
    if (error) {
941
947
        _hb_close_stream(stream);
950
956
HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
951
957
{
952
958
    HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec));
 
959
    if (!face)
 
960
        return 0;
953
961
 
954
962
    face->isSymbolFont = false;
955
963
    face->gdef = 0;
961
969
    face->tmpAttributes = 0;
962
970
    face->tmpLogClusters = 0;
963
971
    face->glyphs_substituted = false;
 
972
    face->buffer = 0;
964
973
 
965
974
    HB_Error error;
966
975
    HB_Stream stream;
996
1005
    for (unsigned int i = 0; i < HB_ScriptCount; ++i)
997
1006
        face->supported_scripts[i] = checkScript(face, i);
998
1007
 
999
 
    hb_buffer_new(&face->buffer);
 
1008
    if (hb_buffer_new(&face->buffer) != HB_Err_Ok) {
 
1009
        HB_FreeFace(face);
 
1010
        return 0;
 
1011
    }
1000
1012
 
1001
1013
    return face;
1002
1014
}
1116
1128
 
1117
1129
HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties)
1118
1130
{
 
1131
    HB_GlyphAttributes *tmpAttributes;
 
1132
    unsigned int *tmpLogClusters;
1119
1133
 
1120
1134
    HB_Face face = item->face;
1121
1135
 
1123
1137
 
1124
1138
    hb_buffer_clear(face->buffer);
1125
1139
 
1126
 
    face->tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes));
1127
 
    face->tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int));
 
1140
    tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes));
 
1141
    if (!tmpAttributes)
 
1142
        return false;
 
1143
    face->tmpAttributes = tmpAttributes;
 
1144
 
 
1145
    tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int));
 
1146
    if (!tmpLogClusters)
 
1147
        return false;
 
1148
    face->tmpLogClusters = tmpLogClusters;
 
1149
 
1128
1150
    for (int i = 0; i < face->length; ++i) {
1129
1151
        hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i);
1130
1152
        face->tmpAttributes[i] = item->attributes[i];