Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: implemented text outline #1296

Closed

Conversation

amowogbaje
Copy link
Contributor

I noticed the stroke functionality on text watermark was not functional so I implemented that kindly merge please so i can see it in the next installment

@amowogbaje amowogbaje closed this Feb 6, 2024
@amowogbaje amowogbaje reopened this Feb 6, 2024
Copy link
Member

@olivervogel olivervogel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, thanks for the pull request. I have tested the feature and it works fine. However, I have three important things that need to be added before I can integrate it.

  1. The font system has been heavily rewritten by me in Implement text wrapping #1292. I suggest that you build your PR on the state of the not-yet-integrated state of #1292 , which will be integrated in the next minor release on February 17, 2024.

  2. Intervention image is a library that provides a unified API for GD and Imagick. The goal is that every command will produce the same result when you replace the driver. I realize that this is not always 100% possible, as GD and Imagick work differently, but it should be a benchmark. However, the new feature currently only works with GD. I would ask you to add it for Imagick as well.

  3. Some minor comments I wrote directly in the code.

src/Typography/Font.php Outdated Show resolved Hide resolved
src/Typography/Font.php Outdated Show resolved Hide resolved
src/Interfaces/FontInterface.php Outdated Show resolved Hide resolved
src/Interfaces/FontInterface.php Show resolved Hide resolved
src/Interfaces/FontInterface.php Outdated Show resolved Hide resolved
src/Typography/Font.php Outdated Show resolved Hide resolved
src/Typography/Font.php Show resolved Hide resolved
src/Typography/Font.php Outdated Show resolved Hide resolved
src/Typography/Font.php Show resolved Hide resolved
src/Typography/FontFactory.php Outdated Show resolved Hide resolved
@olivervogel olivervogel linked an issue Feb 6, 2024 that may be closed by this pull request
@olivervogel
Copy link
Member

Thank you for your updates. Please edit the following two things because otherwise I cannot merge it.

  1. The font system has been heavily rewritten by me in Implement text wrapping #1292. I suggest that you build your PR on the state of the not-yet-integrated state of #1292 , which will be integrated in the next minor release on February 17, 2024. I would suggest to merge feature/text-wrapping into this (your) feature branch and fix possible conflicts. After that you can push to GitHub again.

  2. Intervention image is a library that provides a unified API for GD and Imagick. The goal is that every command will produce the same result when you replace the driver. I realize that this is not always 100% possible, as GD and Imagick work differently, but it should be a benchmark. However, the new feature currently only works with GD. I would ask you to add it for Imagick as well.

Text outline with Imagick is definitely possible.

$draw = new ImagickDraw();
$draw->setStrokeColor('#000');
$draw->setStrokeWidth(4);
$draw->setStrokeAntialias(true);

https://www.php.net/manual/en/imagickdraw.setstrokecolor.php
https://www.php.net/manual/en/imagickdraw.setstrokewidth.php
https://www.php.net/manual/en/imagickdraw.setstrokeantialias.php

And it's even easier than with GD. 😄

@amowogbaje
Copy link
Contributor Author

merged feature/text-wrapping into add-outline-to-text branch

@amowogbaje
Copy link
Contributor Author

I am lost with the failed checks

if ($ox !== 0 || $oy !== 0) { // Skip drawing outline for the main text
imagettftext(
$frame->native(),
$this->adjustedFontSize(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method does not exist anymore.

}

$draw = new ImagickDraw();
$draw->setStrokeColor($font->strokeColor());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't work that way. Please check types.


$draw = new ImagickDraw();
$draw->setStrokeColor($font->strokeColor());
$draw->setStrokeWidth($font->strokeWidth());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't work that way. Please check types.

@amowogbaje
Copy link
Contributor Author

amowogbaje commented Feb 12, 2024 via email

@olivervogel
Copy link
Member

olivervogel commented Feb 12, 2024

I just closed this because you opened another MR with the same content. Lets work on #1300

@olivervogel olivervogel removed a link to an issue Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants