• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by Garlov · Jan 22, 2015 at 03:46 PM · textmeshfontsfontsize

How can I obtain an exportable font size?

Hey, I have an A4 page width a pixel size of 210*297. Which have a 1:1 translation to mm. Then I have a textmesh on that page, with some text. All fine. Now comes the problem, I want to export this and create a pdf from the extracted data, but the font size is bogus.

The text : "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" fills up exactly one line of 210 px/mm with the font size 32.9. In indesign if I do the same there I get a fontsize of 9.35pt.

I know I could do a easy calculation with these numbers 32.9/9.35 = 3.5187166, which then will be my ratio. My problem here is that this might not be the same for all fonts or it might not be accurate. my biggest problem is that I do not want a line-break in a different place in unity vs a pdf.

Is there a better and more accurate way to calculate this per font used?

Comment

People who like this

0 Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image team_eden · Jan 22, 2015 at 09:48 PM 0
Share

Just start the app in a regular size, and anchor the text accordingly to the screen. WHen you resize the pdf, unity canvas scaler will do the work. Just make sure your text is set to overflow, on both the horizontal and vertical scales. Hope this helps?

avatar image Garlov · Jan 23, 2015 at 08:40 AM 0
Share

That won't do, I need to be able to save the config for the TextMesh to a file, xml for example. And then send it to a pdf generator. So if I export this:

 <page width="210" height="297">
   <textFrame fontSize="36" x="0" y="0" width="210" height="120">Lorem ipsum dolor sit amet, id tritani aliquando omittantur eum.</textFrame>
 </page>

If that fontSize is 36 in Unity, when it's really 10-ish pt in a real document, I'll have a problem. Then the text will display differently in Unity and the in generated pdf.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

How can I achieve advanced text effects? 1 Answer

TextMeshpro material instance being created 0 Answers

Best way to properly scale text? 0 Answers

Text disappearing whenever it feels like doing so. 1 Answer

Chinese Japanese Korean dynamic font 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges