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

Side by Side Diff: third_party/harfbuzz-ng/src/hb-buffer.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-buffer.h ('k') | third_party/harfbuzz-ng/src/hb-common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright © 1998-2004 David Turner and Werner Lemberg 2 * Copyright © 1998-2004 David Turner and Werner Lemberg
3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. 3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc.
4 * Copyright © 2011,2012 Google, Inc. 4 * Copyright © 2011,2012 Google, Inc.
5 * 5 *
6 * This is part of HarfBuzz, a text shaping library. 6 * This is part of HarfBuzz, a text shaping library.
7 * 7 *
8 * Permission is hereby granted, without written agreement and without 8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this 9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the 10 * software and its documentation for any purpose, provided that the
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 * taking buffer script into consideration when choosing a language. 1321 * taking buffer script into consideration when choosing a language.
1322 * 1322 *
1323 * Since: 1.0 1323 * Since: 1.0
1324 **/ 1324 **/
1325 void 1325 void
1326 hb_buffer_guess_segment_properties (hb_buffer_t *buffer) 1326 hb_buffer_guess_segment_properties (hb_buffer_t *buffer)
1327 { 1327 {
1328 buffer->guess_segment_properties (); 1328 buffer->guess_segment_properties ();
1329 } 1329 }
1330 1330
1331 template <bool validate, typename T> 1331 template <typename utf_t>
1332 static inline void 1332 static inline void
1333 hb_buffer_add_utf (hb_buffer_t *buffer, 1333 hb_buffer_add_utf (hb_buffer_t *buffer,
1334 » » const T *text, 1334 » » const typename utf_t::codepoint_t *text,
1335 int text_length, 1335 int text_length,
1336 unsigned int item_offset, 1336 unsigned int item_offset,
1337 int item_length) 1337 int item_length)
1338 { 1338 {
1339 typedef hb_utf_t<T, true> utf_t; 1339 typedef typename utf_t::codepoint_t T;
1340 const hb_codepoint_t replacement = buffer->replacement; 1340 const hb_codepoint_t replacement = buffer->replacement;
1341 1341
1342 assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || 1342 assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
1343 (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALI D)); 1343 (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALI D));
1344 1344
1345 if (unlikely (hb_object_is_inert (buffer))) 1345 if (unlikely (hb_object_is_inert (buffer)))
1346 return; 1346 return;
1347 1347
1348 if (text_length == -1) 1348 if (text_length == -1)
1349 text_length = utf_t::strlen (text); 1349 text_length = utf_t::strlen (text);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 next = utf_t::next (next, end, &u, replacement); 1393 next = utf_t::next (next, end, &u, replacement);
1394 buffer->context[1][buffer->context_len[1]++] = u; 1394 buffer->context[1][buffer->context_len[1]++] = u;
1395 } 1395 }
1396 1396
1397 buffer->content_type = HB_BUFFER_CONTENT_TYPE_UNICODE; 1397 buffer->content_type = HB_BUFFER_CONTENT_TYPE_UNICODE;
1398 } 1398 }
1399 1399
1400 /** 1400 /**
1401 * hb_buffer_add_utf8: 1401 * hb_buffer_add_utf8:
1402 * @buffer: a buffer. 1402 * @buffer: a buffer.
1403 * @text: (array length=text_length): 1403 * @text: (array length=text_length) (element-type uint8_t):
1404 * @text_length: 1404 * @text_length:
1405 * @item_offset: 1405 * @item_offset:
1406 * @item_length: 1406 * @item_length:
1407 * 1407 *
1408 * 1408 *
1409 * 1409 *
1410 * Since: 1.0 1410 * Since: 1.0
1411 **/ 1411 **/
1412 void 1412 void
1413 hb_buffer_add_utf8 (hb_buffer_t *buffer, 1413 hb_buffer_add_utf8 (hb_buffer_t *buffer,
1414 const char *text, 1414 const char *text,
1415 int text_length, 1415 int text_length,
1416 unsigned int item_offset, 1416 unsigned int item_offset,
1417 int item_length) 1417 int item_length)
1418 { 1418 {
1419 hb_buffer_add_utf<true> (buffer, (const uint8_t *) text, text_length, item_off set, item_length); 1419 hb_buffer_add_utf<hb_utf8_t> (buffer, (const uint8_t *) text, text_length, ite m_offset, item_length);
1420 } 1420 }
1421 1421
1422 /** 1422 /**
1423 * hb_buffer_add_utf16: 1423 * hb_buffer_add_utf16:
1424 * @buffer: a buffer. 1424 * @buffer: a buffer.
1425 * @text: (array length=text_length): 1425 * @text: (array length=text_length):
1426 * @text_length: 1426 * @text_length:
1427 * @item_offset: 1427 * @item_offset:
1428 * @item_length: 1428 * @item_length:
1429 * 1429 *
1430 * 1430 *
1431 * 1431 *
1432 * Since: 1.0 1432 * Since: 1.0
1433 **/ 1433 **/
1434 void 1434 void
1435 hb_buffer_add_utf16 (hb_buffer_t *buffer, 1435 hb_buffer_add_utf16 (hb_buffer_t *buffer,
1436 const uint16_t *text, 1436 const uint16_t *text,
1437 int text_length, 1437 int text_length,
1438 unsigned int item_offset, 1438 unsigned int item_offset,
1439 int item_length) 1439 int item_length)
1440 { 1440 {
1441 hb_buffer_add_utf<true> (buffer, text, text_length, item_offset, item_length); 1441 hb_buffer_add_utf<hb_utf16_t> (buffer, text, text_length, item_offset, item_le ngth);
1442 } 1442 }
1443 1443
1444 /** 1444 /**
1445 * hb_buffer_add_utf32: 1445 * hb_buffer_add_utf32:
1446 * @buffer: a buffer. 1446 * @buffer: a buffer.
1447 * @text: (array length=text_length): 1447 * @text: (array length=text_length):
1448 * @text_length: 1448 * @text_length:
1449 * @item_offset: 1449 * @item_offset:
1450 * @item_length: 1450 * @item_length:
1451 * 1451 *
1452 * 1452 *
1453 * 1453 *
1454 * Since: 1.0 1454 * Since: 1.0
1455 **/ 1455 **/
1456 void 1456 void
1457 hb_buffer_add_utf32 (hb_buffer_t *buffer, 1457 hb_buffer_add_utf32 (hb_buffer_t *buffer,
1458 const uint32_t *text, 1458 const uint32_t *text,
1459 int text_length, 1459 int text_length,
1460 unsigned int item_offset, 1460 unsigned int item_offset,
1461 int item_length) 1461 int item_length)
1462 { 1462 {
1463 hb_buffer_add_utf<true> (buffer, text, text_length, item_offset, item_length); 1463 hb_buffer_add_utf<hb_utf32_t<> > (buffer, text, text_length, item_offset, item _length);
1464 } 1464 }
1465 1465
1466 /** 1466 /**
1467 * hb_buffer_add_latin1:
1468 * @buffer: a buffer.
1469 * @text: (array length=text_length) (element-type uint8_t):
1470 * @text_length:
1471 * @item_offset:
1472 * @item_length:
1473 *
1474 *
1475 *
1476 * Since: 1.0
1477 **/
1478 void
1479 hb_buffer_add_latin1 (hb_buffer_t *buffer,
1480 const uint8_t *text,
1481 int text_length,
1482 unsigned int item_offset,
1483 int item_length)
1484 {
1485 hb_buffer_add_utf<hb_latin1_t> (buffer, text, text_length, item_offset, item_l ength);
1486 }
1487
1488 /**
1467 * hb_buffer_add_codepoints: 1489 * hb_buffer_add_codepoints:
1468 * @buffer: a buffer. 1490 * @buffer: a buffer.
1469 * @text: (array length=text_length): 1491 * @text: (array length=text_length):
1470 * @text_length: 1492 * @text_length:
1471 * @item_offset: 1493 * @item_offset:
1472 * @item_length: 1494 * @item_length:
1473 * 1495 *
1474 * 1496 *
1475 * 1497 *
1476 * Since: 1.0 1498 * Since: 1.0
1477 **/ 1499 **/
1478 void 1500 void
1479 hb_buffer_add_codepoints (hb_buffer_t *buffer, 1501 hb_buffer_add_codepoints (hb_buffer_t *buffer,
1480 const hb_codepoint_t *text, 1502 const hb_codepoint_t *text,
1481 int text_length, 1503 int text_length,
1482 unsigned int item_offset, 1504 unsigned int item_offset,
1483 int item_length) 1505 int item_length)
1484 { 1506 {
1485 hb_buffer_add_utf<false> (buffer, text, text_length, item_offset, item_length) ; 1507 hb_buffer_add_utf<hb_utf32_t<false> > (buffer, text, text_length, item_offset, item_length);
1486 } 1508 }
1487 1509
1488 1510
1489 static int 1511 static int
1490 compare_info_codepoint (const hb_glyph_info_t *pa, 1512 compare_info_codepoint (const hb_glyph_info_t *pa,
1491 const hb_glyph_info_t *pb) 1513 const hb_glyph_info_t *pb)
1492 { 1514 {
1493 return (int) pb->codepoint - (int) pa->codepoint; 1515 return (int) pb->codepoint - (int) pa->codepoint;
1494 } 1516 }
1495 1517
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 1585
1564 unsigned int start = 0; 1586 unsigned int start = 0;
1565 unsigned int end; 1587 unsigned int end;
1566 for (end = start + 1; end < count; end++) 1588 for (end = start + 1; end < count; end++)
1567 if (info[start].cluster != info[end].cluster) { 1589 if (info[start].cluster != info[end].cluster) {
1568 normalize_glyphs_cluster (buffer, start, end, backward); 1590 normalize_glyphs_cluster (buffer, start, end, backward);
1569 start = end; 1591 start = end;
1570 } 1592 }
1571 normalize_glyphs_cluster (buffer, start, end, backward); 1593 normalize_glyphs_cluster (buffer, start, end, backward);
1572 } 1594 }
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-buffer.h ('k') | third_party/harfbuzz-ng/src/hb-common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698