Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: third_party/harfbuzz/src/harfbuzz-shaper.cpp

Issue 7595001: Update (old) harfbuzz to ToT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This is part of HarfBuzz, an OpenType Layout engine library. 4 * This is part of HarfBuzz, an OpenType Layout engine library.
5 * 5 *
6 * Permission is hereby granted, without written agreement and without 6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this 7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the 8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in 9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software. 10 * all copies of this software.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 lineBreakType = HB_ForcedBreak; 176 lineBreakType = HB_ForcedBreak;
177 } else if(cls == HB_LineBreak_CR) { 177 } else if(cls == HB_LineBreak_CR) {
178 lineBreakType = (ncls == HB_LineBreak_LF) ? HB_NoBreak : HB_ForcedBr eak; 178 lineBreakType = (ncls == HB_LineBreak_LF) ? HB_NoBreak : HB_ForcedBr eak;
179 } 179 }
180 180
181 if (ncls == HB_LineBreak_SP) 181 if (ncls == HB_LineBreak_SP)
182 goto next_no_cls_update; 182 goto next_no_cls_update;
183 if (ncls >= HB_LineBreak_CR) 183 if (ncls >= HB_LineBreak_CR)
184 goto next; 184 goto next;
185 185
186 // two complex chars (thai or lao), thai_attributes might override, but here we do a best guess
187 if (cls == HB_LineBreak_SA && ncls == HB_LineBreak_SA) {
188 lineBreakType = HB_Break;
189 goto next;
190 }
191
192 { 186 {
193 int tcls = ncls; 187 int tcls = ncls;
188 // for south east asian chars that require a complex (dictionary ana lysis), the unicode
189 // standard recommends to treat them as AL. thai_attributes and othe r attribute methods that
190 // do dictionary analysis can override
194 if (tcls >= HB_LineBreak_SA) 191 if (tcls >= HB_LineBreak_SA)
195 tcls = HB_LineBreak_ID; 192 tcls = HB_LineBreak_AL;
196 if (cls >= HB_LineBreak_SA) 193 if (cls >= HB_LineBreak_SA)
197 cls = HB_LineBreak_ID; 194 cls = HB_LineBreak_AL;
198 195
199 int brk = breakTable[cls][tcls]; 196 int brk = breakTable[cls][tcls];
200 switch (brk) { 197 switch (brk) {
201 case DirectBreak: 198 case DirectBreak:
202 lineBreakType = HB_Break; 199 lineBreakType = HB_Break;
203 if (uc[i-1] == 0xad) // soft hyphen 200 if (uc[i-1] == 0xad) // soft hyphen
204 lineBreakType = HB_SoftHyphen; 201 lineBreakType = HB_SoftHyphen;
205 break; 202 break;
206 case IndirectBreak: 203 case IndirectBreak:
207 lineBreakType = (lcls == HB_LineBreak_SP) ? HB_Break : HB_NoBrea k; 204 lineBreakType = (lcls == HB_LineBreak_SP) ? HB_Break : HB_NoBrea k;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 #endif 576 #endif
580 577
581 HB_HeuristicPosition(shaper_item); 578 HB_HeuristicPosition(shaper_item);
582 return true; 579 return true;
583 } 580 }
584 581
585 const HB_ScriptEngine HB_ScriptEngines[] = { 582 const HB_ScriptEngine HB_ScriptEngines[] = {
586 // Common 583 // Common
587 { HB_BasicShape, 0}, 584 { HB_BasicShape, 0},
588 // Greek 585 // Greek
589 { HB_BasicShape, 0}, 586 { HB_GreekShape, 0},
590 // Cyrillic 587 // Cyrillic
591 { HB_BasicShape, 0}, 588 { HB_BasicShape, 0},
592 // Armenian 589 // Armenian
593 { HB_BasicShape, 0}, 590 { HB_BasicShape, 0},
594 // Hebrew 591 // Hebrew
595 { HB_HebrewShape, 0 }, 592 { HB_HebrewShape, 0 },
596 // Arabic 593 // Arabic
597 { HB_ArabicShape, 0}, 594 { HB_ArabicShape, 0},
598 // Syriac 595 // Syriac
599 { HB_ArabicShape, 0}, 596 { HB_ArabicShape, 0},
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 face->gpos = 0; 964 face->gpos = 0;
968 face->gsub = 0; 965 face->gsub = 0;
969 face->current_script = HB_ScriptCount; 966 face->current_script = HB_ScriptCount;
970 face->current_flags = HB_ShaperFlag_Default; 967 face->current_flags = HB_ShaperFlag_Default;
971 face->has_opentype_kerning = false; 968 face->has_opentype_kerning = false;
972 face->tmpAttributes = 0; 969 face->tmpAttributes = 0;
973 face->tmpLogClusters = 0; 970 face->tmpLogClusters = 0;
974 face->glyphs_substituted = false; 971 face->glyphs_substituted = false;
975 face->buffer = 0; 972 face->buffer = 0;
976 973
977 HB_Error error; 974 HB_Error error = HB_Err_Ok;
978 HB_Stream stream; 975 HB_Stream stream;
979 HB_Stream gdefStream; 976 HB_Stream gdefStream;
980 977
981 gdefStream = getTableStream(font, tableFunc, TTAG_GDEF); 978 gdefStream = getTableStream(font, tableFunc, TTAG_GDEF);
979 error = HB_Err_Not_Covered;
982 if (!gdefStream || (error = HB_Load_GDEF_Table(gdefStream, &face->gdef))) { 980 if (!gdefStream || (error = HB_Load_GDEF_Table(gdefStream, &face->gdef))) {
983 //DEBUG("error loading gdef table: %d", error); 981 //DEBUG("error loading gdef table: %d", error);
984 face->gdef = 0; 982 face->gdef = 0;
985 } 983 }
986 984
987 //DEBUG() << "trying to load gsub table"; 985 //DEBUG() << "trying to load gsub table";
988 stream = getTableStream(font, tableFunc, TTAG_GSUB); 986 stream = getTableStream(font, tableFunc, TTAG_GSUB);
987 error = HB_Err_Not_Covered;
989 if (!stream || (error = HB_Load_GSUB_Table(stream, &face->gsub, face->gdef, gdefStream))) { 988 if (!stream || (error = HB_Load_GSUB_Table(stream, &face->gsub, face->gdef, gdefStream))) {
990 face->gsub = 0; 989 face->gsub = 0;
991 if (error != HB_Err_Not_Covered) { 990 if (error != HB_Err_Not_Covered) {
992 //DEBUG("error loading gsub table: %d", error); 991 //DEBUG("error loading gsub table: %d", error);
993 } else { 992 } else {
994 //DEBUG("face doesn't have a gsub table"); 993 //DEBUG("face doesn't have a gsub table");
995 } 994 }
996 } 995 }
997 _hb_close_stream(stream); 996 _hb_close_stream(stream);
998 997
999 stream = getTableStream(font, tableFunc, TTAG_GPOS); 998 stream = getTableStream(font, tableFunc, TTAG_GPOS);
999 error = HB_Err_Not_Covered;
1000 if (!stream || (error = HB_Load_GPOS_Table(stream, &face->gpos, face->gdef, gdefStream))) { 1000 if (!stream || (error = HB_Load_GPOS_Table(stream, &face->gpos, face->gdef, gdefStream))) {
1001 face->gpos = 0; 1001 face->gpos = 0;
1002 DEBUG("error loading gpos table: %d", error); 1002 DEBUG("error loading gpos table: %d", error);
1003 } 1003 }
1004 _hb_close_stream(stream); 1004 _hb_close_stream(stream);
1005 1005
1006 _hb_close_stream(gdefStream); 1006 _hb_close_stream(gdefStream);
1007 1007
1008 for (unsigned int i = 0; i < HB_ScriptCount; ++i) 1008 for (unsigned int i = 0; i < HB_ScriptCount; ++i)
1009 face->supported_scripts[i] = checkScript(face, i); 1009 face->supported_scripts[i] = checkScript(face, i);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 if (shaper_item->num_glyphs < shaper_item->item.length) { 1350 if (shaper_item->num_glyphs < shaper_item->item.length) {
1351 shaper_item->num_glyphs = shaper_item->item.length; 1351 shaper_item->num_glyphs = shaper_item->item.length;
1352 return false; 1352 return false;
1353 } 1353 }
1354 assert(shaper_item->item.script < HB_ScriptCount); 1354 assert(shaper_item->item.script < HB_ScriptCount);
1355 result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); 1355 result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item);
1356 shaper_item->glyphIndicesPresent = false; 1356 shaper_item->glyphIndicesPresent = false;
1357 return result; 1357 return result;
1358 } 1358 }
1359 1359
OLDNEW
« no previous file with comments | « third_party/harfbuzz/src/harfbuzz-shaper.h ('k') | third_party/harfbuzz/src/harfbuzz-shaper-all.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698