Skip to content

Releases: yilanboy/preview

2.4.0

Choose a tag to compare

@yilanboy yilanboy released this 16 Sep 09:14

What's Changed

Full Changelog: 2.3.0...2.4.0

2.3.0

Choose a tag to compare

@yilanboy yilanboy released this 15 Jul 07:54
d86977a

What's Changed

  • chore(deps-dev): bump the composer-version group across 1 directory with 2 updates by @dependabot[bot] in #10
  • Feat/add quality option by @yilanboy in #11

Full Changelog: 2.2.0...2.3.0

2.2.0

Choose a tag to compare

@yilanboy yilanboy released this 24 Jun 06:36
f149f9e

Added

  • New Font cases adding a Medium (500) weight for every bundled family, plus a new monospaced family: InterMedium,
    RobotoMedium, JetBrainsMono, JetBrainsMonoMedium, NotoSansMedium, NotoSansSCMedium, NotoSansTCMedium, and
    NotoSansJPMedium. Each family now ships a Regular (400) and a Medium (500) variant.

Changed

  • Bundled fonts are now static TrueType instances instead of variable fonts, so GD renders the intended weight and
    optical size (imagettftext cannot select an axis from a variable font). This changes the rendered output of the
    existing Font::Inter (now the 24pt optical cut), Font::Roboto, and Font::NotoSans cases — regenerate any cached
    images after upgrading.

2.1.0

Choose a tag to compare

@yilanboy yilanboy released this 20 Jun 09:58
8580842

Added

  • Added Generator::bytes() to return encoded image bytes as a string.
  • Added Laravel/framework-friendly usage examples for returning responses and storing generated images.

Changed

  • Documented bytes() as a third output method alongside output() and save().

Fixed

  • Improved image byte test coverage across PNG, JPEG, and WEBP formats.

2.0.0

Choose a tag to compare

@yilanboy yilanboy released this 15 Jun 15:24

The first stable 2.0 release. This is a ground-up rewrite of the rendering
pipeline with a new Generator entry point, composable backgrounds, accurate
font metrics, and multi-language text support. It consolidates everything from
2.0.0-beta.1 through 2.0.0-beta.4.

Upgrading from 1.x? This release is not backward compatible — see
Breaking Changes below. Install with composer require yilanboy/preview:^2.0.

💥 Breaking Changes

  • Minimum PHP is now ^8.4 (was ^8.2).
  • Image\Builder is replaced by Generator as the main entry point — an API
    rename, not backward compatible.
  • Color\Converter is replaced by a top-level ColorConverter with static
    methods; dependency injection removed.
  • The backgroundColor shortcut is removed. Backgrounds are now configured
    via dedicated background classes (Solid, Gradient, Image).
  • Background interfaces moved into a Contracts namespace (Contracts\Background).
  • Text handling reworked around a new TextBlock value object and an internal
    layout engine.

✨ Added

  • Composable backgrounds (Yilanboy\Preview\Canvas):
    • Solid — a flat color.
    • Gradient — two-color interpolation with a GradientDirection enum
      (Vertical, Horizontal, Diagonal).
    • Image — a bitmap background with an ImageFit enum (Cover, Contain,
      Stretch, Tile), configurable opacity, and a tint color.
  • TextBlock value object (immutable, final readonly) for title and
    description text, with Font, FontSize, Alignment, LineHeight, and
    Position enums. Title and description stack without overlapping.
  • Custom TrueType fonts — pass a .ttf file path, validated on construction
    (OpenType / non-TTF files are rejected).
  • Multi-language text rendering for Traditional Chinese, Simplified Chinese,
    and Japanese, with appropriate word/character wrapping.
  • Custom canvas sizes and font sizes — Generator::dimensions(int, int) and a
    custom integer pixel FontSize, both validated (InvalidInput below 1).
  • Size, Margin, and Format enums for canvas presets and output encoding.
  • Typed exceptions in a new Exceptions namespace: InvalidInput and
    RenderFailure, both implementing the PreviewException marker interface.
    Backward compatible — they still extend the SPL exceptions the library threw
    before, so existing catch blocks keep working.
  • Color validation enforced at construction across all color-accepting types
    via ColorConverter::isValidColor() (named colors or hex).

🛠 Improved & Fixed

  • Accurate line height derived directly from the font's head/hhea sfnt
    tables (via a new LineMetrics value object) instead of glyph bounding-box
    probing.
  • More robust font parsing — sfnt tables are validated and binary unpacking
    errors are handled gracefully, throwing RenderFailure on corrupt font files.
  • Faster rendering — text lines are measured once during wrapping and reused
    at placement; Image backgrounds decode the source file once and cache the
    bitmap.

Full Changelog: 1.0.1...2.0.0

1.0.1

Choose a tag to compare

@yilanboy yilanboy released this 21 Dec 10:42
  • remove default text
  • change default font size

Initial release

Choose a tag to compare

@yilanboy yilanboy released this 21 Dec 09:49
1.0.0

docs: create changelog