diff --git a/pyproject.toml b/pyproject.toml index 570aef8af..fe73db7d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ requires-python = '>=3.7' readme = {file = 'README.rst', content-type = 'text/x-rst'} license = {file = 'LICENSE'} dependencies = [ - 'pydyf >=0.6.0', + 'pydyf >=0.8.0', 'cffi >=0.6', 'html5lib >=1.1', 'tinycss2 >=1.0.0', diff --git a/weasyprint/draw.py b/weasyprint/draw.py index 44d94575f..75be102eb 100644 --- a/weasyprint/draw.py +++ b/weasyprint/draw.py @@ -1179,9 +1179,25 @@ def draw_first_line(stream, textbox, text_overflow, block_ellipsis, matrix): utf8_position = utf8_positions[i] offset = glyph_info.geometry.x_offset / font_size - if offset: - string += f'>{-offset}<' - string += f'{glyph:02x}' if font.bitmap else f'{glyph:04x}' + rise = glyph_info.geometry.y_offset / 1000 + if rise: + if string[-1] == '<': + string = string[:-1] + else: + string += '>' + stream.show_text(string) + stream.set_text_rise(-rise) + string = '' + if offset: + string = f'{-offset}' + string += f'<{glyph:02x}>' if font.bitmap else f'<{glyph:04x}>' + stream.show_text(string) + stream.set_text_rise(0) + string = '<' + else: + if offset: + string += f'>{-offset}<' + string += f'{glyph:02x}' if font.bitmap else f'{glyph:04x}' # Ink bounding box and logical widths in font if glyph not in font.widths: