How to install Ariel font via docker file



  • Hi sir,
    I have tried to import font as asset in report template it works but instead importing font to each template is very difficult so can u please help me how to install Ariel font vai docker file?



  • have tried to import font as asset in report template it works but instead importing font to each template is very difficult

    Why is that difficult? It could be a one-helper call I think.

    please help me how to install Ariel font vai docker file?

    Please try some general forums. Installing font to docker is a general thing you should get answer to on StackOverflow for example.

    https://askubuntu.com/questions/651441/how-to-install-arial-font-and-other-windows-fonts-in-ubuntu



  • thank you sir for your reply. i have tried to install font via docker and it is working but my issue we have created more than 100 templates where we used font weight bold in css earlier font weight was not working in production but after installing font it is working but i want to change the font weight 400 for all the bold font weight using font face in css otherwise bold color is very dark and template elegant gone.instead of manually adding font face for each template is there any global css in jsreport?



  • hi sir,
    Sorry for troubling you could you please reply?


  • administrators

    instead of manually adding font face for each template is there any global css in jsreport?

    i understand the problem, you want now to update all templates to a different font weight, however there is no way to apply global css.

    each template is isolated from that, however jsreport scripts is something you can make it to run for all templates, you just create one and change its scope to global from the jsreport studio. in the script you can define a beforeRender that changes the template content (just for the execution, the change won't be persisted) at runtime.

    async function beforeRender(req, res)  {  
        // you can put logic here that modifies the template content to include that font-weight
        req.template.content = req.template.content.replace(...)
    }
    

    it is possible by using the global script, however i don't recommend this, i think it is better if you manually add this explicit font-weight to each template, you will have better control and less chances that some template after the change produce some unexpected output.



  • thank you so much sir for your reply. So you are saying that instead of install font from docker file i have to import font as asset for each template and change font weight using fontface right?

    But our application is multi tenant so each tenant have their own template so by importing font like this for every template (in order to work font weight bold ) is the store size in our case mongo db size exceed right?

    is this is the better solution?Im dont have much knowledge in css


  • administrators

    i have tried to install font via docker and it is working but my issue we have created more than 100 templates where we used font weight bold in css earlier font weight was not working in production but after installing font it is working but i want to change the font weight 400 for all the bold font weight using font face in css otherwise bold color is very dark and template elegant gone.instead of manually adding font face for each template is there any global css in jsreport?

    i think in both cases, either installing font in docker (and having the need to adjust font-weight) or import font as asset you will need to modify all templates, so at this point it is something you need to decide what works better for you.

    But our application is multi tenant so each tenant have their own template so by importing font like this for every template (in order to work font weight bold ) is the store size in our case mongo db size exceed right?

    i don't know how your templates are organized, or how are you making the jsreport templates work in multi tenant way, are you using folder with permissions to do this? or something else?, this seems like an important part to know in order to recommend something. depending on how you are making this, it will affect the store size. if each tenant needs a specific copy of the template then it is likely you will also need to duplicate the font, in which case the solution to install font globally on docker does not sound bad.



  • we have two folders one is global where we store all templates and another is client folder where we store a copy of global template against each tenant.

    Above is our template structure in multi tenant application.
    We were not using permission.What permission you are talking about just for my understanding?
    is there any api for permission in jsreport against folder?


  • administrators

    Above is our template structure in multi tenant application

    ok, so you are making a copy of your entities (template, assets, etc) for each of your tenants. but according to your structure i don't think there is nothing stopping you to create the asset font on your global folder and then reference it (just reference in your template, not actually copying it) manually for each template, then this way you will only have one copy of the asset font used for all the templates, you won't need to care about your store size increasing. just make sure to use an absolute path for the asset call like {{asset "/Global folder/yourfont.ttf" ...., this way you won't need to update the call if you move the template or copy to somewhere else at different path level.

    We were not using permission.What permission you are talking about just for my understanding?
    is there any api for permission in jsreport against folder?

    yes, against entities (templates, assets, folders, etc) https://jsreport.net/learn/authorization
    however since you are not using this, it may not be relevant for you right now, perhaps evaluate it later in the future if it makes for your case to restrict access to the template depending on users.



  • Or we can create font folder in the root level and import what ever font we need as asset and refer this folder path for
    all templates right?

    Thank you so much sir for clearing all my doubts patiently this means a lot for me .
    Thanks.


  • administrators

    Or we can create font folder in the root level and import what ever font we need as asset and refer this folder path for
    all templates right?

    yes, you get the idea 👌

    Thank you so much sir for clearing all my doubts patiently this means a lot for me .

    👍


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.