def strut_layout(style, context=None):
    """Return a tuple of the used value of ``line-height`` and the baseline.

    The baseline is given from the top edge of line height.

    """
    if style['font_size'] == 0:
        return 0, 0

    if context:
        key = _font_style_cache_key(style, include_size=True)
        if key in context.strut_layouts:
            return context.strut_layouts[key]

    layout = Layout(context, style)
    layout.set_text(' ')
    line, _ = layout.get_first_line()
    _, _, _, _, text_height, baseline = first_line_metrics(
        line, '', layout, resume_at=None, space_collapse=False, style=style)
    if style['line_height'] == 'normal':
        result = text_height, baseline
        if context:
            context.strut_layouts[key] = result
        return result
    type_, line_height = style['line_height']
    if type_ == 'NUMBER':
        line_height *= style['font_size']
    result = line_height, baseline + (line_height - text_height) / 2
    if context:
        context.strut_layouts[key] = result
    return result
Return a tuple of the used value of ``line-height`` and the baseline.

The baseline is given from the top edge of line height.
weasyprint/css/computed_values.py