mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 00:21:15 +03:00
Display some text
This commit is contained in:
parent
590c0c57ce
commit
0dcddc7a4e
@ -106,6 +106,7 @@ class Context(pydyf.Stream):
|
||||
font_hash = hash(font)
|
||||
if font_hash not in self._fonts:
|
||||
self._fonts[font_hash] = Font(font, pango_font, glyph_item, ffi)
|
||||
return font_hash
|
||||
|
||||
|
||||
BookmarkSubtree = collections.namedtuple(
|
||||
@ -907,7 +908,7 @@ class Document:
|
||||
'FirstChar': 32,
|
||||
'LastChar': 99,
|
||||
'Encoding': '/WinAnsiEncoding',
|
||||
'Widths': pydyf.Array((99 - 32 + 1) * [0]),
|
||||
'Widths': pydyf.Array((99 - 32 + 1) * [1000]),
|
||||
'FontDescriptor': pydyf.Dictionary({
|
||||
'FontName': pydyf.String('Liberation'),
|
||||
'FontFamily': '/AAAAAA+Liberation',
|
||||
|
@ -1319,14 +1319,18 @@ def show_first_line(context, textbox, text_overflow):
|
||||
data = harfbuzz.hb_blob_get_data(harfbuzz.hb_face_reference_blob(
|
||||
harfbuzz.hb_font_get_face(hb_font)), length)
|
||||
font = ffi.unpack(data, int(length[0]))
|
||||
context.add_font(font, pango_font, glyph_item, ffi)
|
||||
font_hash = context.add_font(font, pango_font, glyph_item, ffi)
|
||||
if run.next == ffi.NULL:
|
||||
break
|
||||
else:
|
||||
run = run.next
|
||||
ffi.release(length)
|
||||
# context = ffi.cast('cairo_t *', context._pointer)
|
||||
# pangocairo.pango_cairo_show_layout_line(context, first_line)
|
||||
|
||||
context.stream.append('BT')
|
||||
context.stream.append('12 0 0 -12 62.25 72.945312 Tm')
|
||||
context.stream.append(f'/{font_hash} 1 Tf')
|
||||
context.stream.append(f'[({textbox.text})]TJ')
|
||||
context.stream.append('ET')
|
||||
|
||||
|
||||
def get_log_attrs(text, lang):
|
||||
|
Loading…
Reference in New Issue
Block a user