Coder Social home page Coder Social logo

Comments (6)

ankush-me avatar ankush-me commented on August 27, 2024

Thank you, you're right, this function is being called here with font-size in points. This is likely a typo -- does using f_h_px instead of f_h give better results? Can you please confirm this?

from synthtext.

CatherineYao avatar CatherineYao commented on August 27, 2024

So, maybe f_h is not necessary and function get_font_size which transfer px to pt is not needed? We can just use px to do all calculation, right? @ankush-me

from synthtext.

CatherineYao avatar CatherineYao commented on August 27, 2024

I found that font.size must be type of pt, so get_font_size is needed.
font = self.text_renderer.font_state.sample() font = self.text_renderer.font_state.init_font(font)
In this code, font size is randomly obtained but it does truly assigned to a value in font.size = f_h , right?

from synthtext.

ankush-me avatar ankush-me commented on August 27, 2024

Your second comment is correct.

from synthtext.

CatherineYao avatar CatherineYao commented on August 27, 2024

def get_nline_nchar(self,mask_size,font_height,font_width):
"""
Returns the maximum number of lines and characters which can fit
in the MASK_SIZED image.
"""
H,W = mask_size
nline = int(np.ceil(H/(2font_height)))
nchar = int(np.floor(W/font_width))
return nline,nchar
You mean my last comment?
And there's still a question that why nline equals to H/(2
font_height) instead of H/font_height.

from synthtext.

ankush-me avatar ankush-me commented on August 27, 2024

Yes, last comment. 2*font_height, because we also want to insert some "line-spacing" / leave some space / not cramp in too much.

from synthtext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.