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

text tag #2246

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

text tag #2246

wants to merge 1 commit into from

Conversation

mgrudzinska
Copy link
Collaborator

@mgrudzinska mgrudzinska commented May 5, 2024

todo:

  • default values handling
  • font-family multi values
  • fix grad?
  • meson - better idea?
Zrzut ekranu 2024-05-6 o 00 43 31
<svg viewBox="0 0 125 115">
  <defs>
    <linearGradient id="rainbow" x1="0" x2="0" y1="20%" y2="100%" gradientUnits="userSpaceOnUse" >
      <stop stop-color="#ff00ff" offset="0%"/>
      <stop stop-color="#FF5447" offset="30%"/>
      <stop stop-color="#FF7B21" offset="40%"/>
      <stop stop-color="#EAFC37" offset="60%"/>
      <stop stop-color="#4FCB6B" offset="80%"/>
      <stop stop-color="#0000ff" offset="100%"/> 
    </linearGradient>
  </defs>
    <text font-family="Monaco" fill="#ff00ff" font-size="25" x="0" y="30">gradient</text>
    <text font-family="Monaco" fill="url(#rainbow)" font-size="45" x="0" y="70">text</text>
    <text font-family="Monaco" font-size="20" x="30" y="100">in svg</text>
    <rect x="120" y="0" width="5" height="115" fill="url(#rainbow)"/>
</svg>

issue: #1897

@mgrudzinska mgrudzinska added enhancement Improve features svg SVG features labels May 5, 2024
@mgrudzinska mgrudzinska self-assigned this May 5, 2024
{
auto text = &loader->svgParse->node->node.text;
if (text->text) free(text->text);
text->text = strndup(content, length);
Copy link
Member

@JSUYA JSUYA May 9, 2024

Choose a reason for hiding this comment

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

inc/thorvg.h Outdated
@@ -1485,7 +1486,7 @@ class TVG_API Text final : public Paint
*
* @note Experimental API
*/
Result fill(uint8_t r, uint8_t g, uint8_t b) noexcept;
Result fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
Copy link
Member

Choose a reason for hiding this comment

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

it has opacity() already ?

@hermet
Copy link
Member

hermet commented May 9, 2024

I'd like to suggest to dismiss these 2 patches in this PR.

ttf_loader: fixing font scaling factor 
common: add arg to text fill

Svg loader could apply the font size directly, as it is supposed to do.
Also, it would be nicer coming up with a svg sample resource to test.

@hermet
Copy link
Member

hermet commented May 23, 2024

@mgrudzinska ping? I think it's easier to apply only with svg_loader updates. if there is a font size issue, we can deal with it separately.

@mgrudzinska
Copy link
Collaborator Author

@hermet I still have to figure out how to access the system fonts or how to deal without them

@hermet
Copy link
Member

hermet commented May 24, 2024

@mgrudzinska Please handle the embedded font as expected for the issue. System fonts must be addressed separately based on the thorvg specifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve features svg SVG features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants