Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
8301998: Update HarfBuzz to 7.0.1
Browse files Browse the repository at this point in the history
Backport-of: f5c8b68c1c4d8bdbf4838aafdcd657fc104420d8
  • Loading branch information
Harshitha Onkar authored and prrace committed Mar 17, 2023
1 parent 5138f5a commit cc4b7e6
Show file tree
Hide file tree
Showing 267 changed files with 28,223 additions and 14,922 deletions.
2 changes: 1 addition & 1 deletion make/modules/java.desktop/lib/Awt2dLibraries.gmk
Expand Up @@ -456,7 +456,7 @@ else
-DHB_NO_PRAGMA_GCC_DIAGNOSTIC
endif
ifeq ($(call isTargetOs, linux macosx), true)
HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES -DHB_NO_VISIBILITY
endif

# Early re-canonizing has to be disabled to workaround an internal XlC compiler error
Expand Down
47 changes: 34 additions & 13 deletions src/java.desktop/share/legal/harfbuzz.md
@@ -1,8 +1,8 @@
## Harfbuzz v4.4.1
## Harfbuzz v7.0.1

### Harfbuzz License

https://github.com/harfbuzz/harfbuzz/blob/4.4.1/COPYING
https://github.com/harfbuzz/harfbuzz/blob/7.0.1/COPYING

<pre>

Expand All @@ -12,21 +12,22 @@ files names COPYING in subdirectories where applicable.

Copyright © 2010-2022 Google, Inc.
Copyright © 2018-2020 Ebrahim Byagowi
Copyright © 2019-2020 Facebook, Inc.
Copyright © 2012-2015 Mozilla Foundation.
Copyright © 2011 Codethink Limited
Copyright © 2008-2010 Nokia Corporation and/or its subsidiary(-ies)
Copyright © 2009 Keith Stribley
Copyright © 2009 Martin Hosken and SIL International
Copyright © 2007 Chris Wilson
Copyright © 2005-2022 Behdad Esfahbod
Copyright © 2005 David Turner
Copyright © 2004-2013 Red Hat, Inc.
Copyright © 1998-2004 David Turner and Werner Lemberg
Copyright © 2016 Elie Roux <elie.roux@telecom-bretagne.eu>
Copyright © 2019 Facebook, Inc.
Copyright © 2007 Chris Wilson
Copyright © 2018-2019 Adobe Inc.
Copyright © 2006-2023 Behdad Esfahbod
Copyright © 1998-2004 David Turner and Werner Lemberg
Copyright © 2009 Keith Stribley
Copyright © 2018 Khaled Hosny
Copyright © 2016 Elie Roux <elie.roux@telecom-bretagne.eu>
Copyright © 2016 Igalia S.L.
Copyright © 2015 Mozilla Foundation.
Copyright © 1999 David Turner
Copyright © 2005 Werner Lemberg
Copyright © 2013-2015 Alexei Podtelezhnikov
Copyright © 2022 Matthias Clasen
Copyright © 2011 Codethink Limited

For full copyright notices consult the individual files in the package.

Expand Down Expand Up @@ -72,3 +73,23 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

</pre>

### AUTHORS File Information
```
Behdad Esfahbod
David Corbett
David Turner
Ebrahim Byagowi
Garret Rieger
Jonathan Kew
Khaled Hosny
Lars Knoll
Martin Hosken
Owen Taylor
Roderick Sheeter
Roozbeh Pournader
Simon Hausmann
Werner Lemberg
```
Expand Up @@ -24,10 +24,11 @@
* Google Author(s): Seigo Nonaka, Calder Kitagawa
*/

#ifndef HB_OT_COLOR_CBDT_TABLE_HH
#define HB_OT_COLOR_CBDT_TABLE_HH
#ifndef OT_COLOR_CBDT_CBDT_HH
#define OT_COLOR_CBDT_CBDT_HH

#include "hb-open-type.hh"
#include "../../../hb-open-type.hh"
#include "../../../hb-paint.hh"

/*
* CBLC -- Color Bitmap Location
Expand Down Expand Up @@ -67,7 +68,7 @@ _copy_data_to_cbdt (hb_vector_t<char> *cbdt_prime,
{
unsigned int new_len = cbdt_prime->length + length;
if (unlikely (!cbdt_prime->alloc (new_len))) return false;
memcpy (cbdt_prime->arrayZ + cbdt_prime->length, data, length);
hb_memcpy (cbdt_prime->arrayZ + cbdt_prime->length, data, length);
cbdt_prime->length = new_len;
return true;
}
Expand All @@ -80,12 +81,15 @@ struct SmallGlyphMetrics
return_trace (c->check_struct (this));
}

void get_extents (hb_font_t *font, hb_glyph_extents_t *extents) const
void get_extents (hb_font_t *font, hb_glyph_extents_t *extents, bool scale) const
{
extents->x_bearing = font->em_scale_x (bearingX);
extents->y_bearing = font->em_scale_y (bearingY);
extents->width = font->em_scale_x (width);
extents->height = font->em_scale_y (-static_cast<int>(height));
extents->x_bearing = bearingX;
extents->y_bearing = bearingY;
extents->width = width;
extents->height = -static_cast<int> (height);

if (scale)
font->scale_glyph_extents (extents);
}

HBUINT8 height;
Expand Down Expand Up @@ -307,7 +311,7 @@ struct IndexSubtable
}
}

bool get_extents (hb_glyph_extents_t *extents HB_UNUSED) const
bool get_extents (hb_glyph_extents_t *extents HB_UNUSED, bool scale HB_UNUSED) const
{
switch (u.header.indexFormat)
{
Expand Down Expand Up @@ -468,13 +472,13 @@ struct IndexSubtableRecord
if (unlikely (!c->serializer->check_success (records->resize (records->length + 1))))
return_trace (false);

(*records)[records->length - 1].firstGlyphIndex = 1;
(*records)[records->length - 1].lastGlyphIndex = 0;
records->tail ().firstGlyphIndex = 1;
records->tail ().lastGlyphIndex = 0;
bitmap_size_context->size += IndexSubtableRecord::min_size;

c->serializer->push ();

if (unlikely (!add_new_subtable (c, bitmap_size_context, &((*records)[records->length - 1]), lookup, base, start)))
if (unlikely (!add_new_subtable (c, bitmap_size_context, &(records->tail ()), lookup, base, start)))
{
c->serializer->pop_discard ();
c->serializer->revert (snap);
Expand Down Expand Up @@ -504,8 +508,8 @@ struct IndexSubtableRecord
return num_missing;
}

bool get_extents (hb_glyph_extents_t *extents, const void *base) const
{ return (base+offsetToSubtable).get_extents (extents); }
bool get_extents (hb_glyph_extents_t *extents, const void *base, bool scale) const
{ return (base+offsetToSubtable).get_extents (extents, scale); }

bool get_image_data (unsigned int gid,
const void *base,
Expand Down Expand Up @@ -833,15 +837,15 @@ struct CBDT
}

bool
get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents, bool scale = true) const
{
const void *base;
const BitmapSizeTable &strike = this->cblc->choose_strike (font);
const IndexSubtableRecord *subtable_record = strike.find_table (glyph, cblc, &base);
if (!subtable_record || !strike.ppemX || !strike.ppemY)
return false;

if (subtable_record->get_extents (extents, base))
if (subtable_record->get_extents (extents, base, scale))
return true;

unsigned int image_offset = 0, image_length = 0, image_format = 0;
Expand All @@ -858,26 +862,29 @@ struct CBDT
if (unlikely (image_length < GlyphBitmapDataFormat17::min_size))
return false;
auto &glyphFormat17 = StructAtOffset<GlyphBitmapDataFormat17> (this->cbdt, image_offset);
glyphFormat17.glyphMetrics.get_extents (font, extents);
glyphFormat17.glyphMetrics.get_extents (font, extents, scale);
break;
}
case 18: {
if (unlikely (image_length < GlyphBitmapDataFormat18::min_size))
return false;
auto &glyphFormat18 = StructAtOffset<GlyphBitmapDataFormat18> (this->cbdt, image_offset);
glyphFormat18.glyphMetrics.get_extents (font, extents);
glyphFormat18.glyphMetrics.get_extents (font, extents, scale);
break;
}
default: return false; /* TODO: Support other image formats. */
}

/* Convert to font units. */
float x_scale = upem / (float) strike.ppemX;
float y_scale = upem / (float) strike.ppemY;
extents->x_bearing = roundf (extents->x_bearing * x_scale);
extents->y_bearing = roundf (extents->y_bearing * y_scale);
extents->width = roundf (extents->width * x_scale);
extents->height = roundf (extents->height * y_scale);
if (scale)
{
float x_scale = upem / (float) strike.ppemX;
float y_scale = upem / (float) strike.ppemY;
extents->x_bearing = roundf (extents->x_bearing * x_scale);
extents->y_bearing = roundf (extents->y_bearing * y_scale);
extents->width = roundf (extents->width * x_scale);
extents->height = roundf (extents->height * y_scale);
}

return true;
}