Skip to content

Story.fit_width() has a weird line  #3599

@stickyfinger7

Description

@stickyfinger7

Description of the bug

def fit_width(self, height, width_min=0, width_max=None, origin=(0, 0), delta=0.001, verbose=False): ''' Finds smallest width in range width_min..width_maxwhere a rect with size(width, height)is large enough to contain the storyself`.

    Returns a `Story.FitResult` instance.
    Returns a `FitResult` instance.

    :arg height:
        height of rect.
    :arg width_min:
        Minimum width to consider; must be >= 0.
    :arg width_max:
        Maximum width to consider, must be >= width_min or `None` for
        infinite.
    :arg origin:
        `(x0, y0)` of rect.
    :arg delta:
        Maximum error in returned width.
    :arg verbose:
        If true we output diagnostics.
    '''
    x0, y0 = origin
    **y1 = x0 + height**
    def fn(width):
        return Rect(x0, y0, x0+width, y1)
    return self.fit(fn, width_min, width_max, delta, verbose)`

why the y1 is defined by x0 + height?? I think it might be y0 + height.

How to reproduce the bug

See the description

PyMuPDF version

1.24.5

Operating system

MacOS

Python version

3.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions