photopea / Typr.js

Typr.js - process fonts in Javascript
MIT License
914 stars 73 forks source link

Will consume more memory? #54

Open xmejsieoke opened 1 month ago

xmejsieoke commented 1 month ago

I am gradually replacing native text rendering with Typr.js. Previously, I loaded fonts using @font-face {font-family: "${font.fileName}"; src: url(${font.fileUrl});} to add styles, or @font-face {font-family: "${d.value}"; src: local("${d.label}"), local("${d.postscriptName}");}. Then, using ctx.font = 'xxx' would magically apply the local or remote font. When I use Typr.js, I have to change the way fonts are loaded, so I created an object in the code to store the currently used local or remote fonts. Does this method consume more memory than before, or is there a better way to store fonts?

photopea commented 1 month ago

I don't think it consumes a lot of memory. The memory consumption corresponds to a size if your TTF file.

On Friday 26 July 2024, xmejsieoke @.***> wrote:

I am gradually replacing native text rendering with Typr.js. Previously, I loaded fonts using @font-face https://github.com/font-face {font-family: "${font.fileName}"; src: url(${font.fileUrl});} to add styles, or @font-face https://github.com/font-face {font-family: "${d.value}"; src: local("${d.label}"), local("${d.postscriptName}");}. Then, using ctx.font = 'xxx' would magically apply the local or remote font. When I use Typr.js, I have to change the way fonts are loaded, so I created an object in the code to store the currently used local or remote fonts. Does this method consume more memory than before, or is there a better way to store fonts?

— Reply to this email directly, view it on GitHub https://github.com/photopea/Typr.js/issues/54, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZXMZSWP7DTAXWUJXESLWLZOGULTAVCNFSM6AAAAABLPUARMGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZTCMRWGY3TCMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>