• Stars
    star
    207
  • Rank 189,769 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

unity-sysfont is a Unity3D plugin for rendering dynamic text using the fonts available on the mobile device/computer.

This page is for Unity 3.x. If you are looking for Unity 4.x please check here.

unity-sysfont

unity-sysfont is a Unity 3D plugin for displaying dynamic text using the fonts available on the mobile device/computer.

Features

  • Multi-platform: iOS/Android/MacOSX support.
  • Unity Editor support: customize the text within the editor and confirm the results immediately.
  • Customizable: change the font family, size, style, color, alignment, and more.
  • Optimized: Alpha-only textures and dynamic texture size adjustment.
  • Programmable: the same fields available in the editor are exposed as properties that you can change programatically.
  • Third-party: integrates well with NGUI scroll lists and other widgets that require clipping.

Requirements

  • Unity 3.4.x or 3.5.x Pro.

Download & Installation

The following files are for Unity 3.x. If you are looking for Unity 4.x please check here.

Change Log

The change log contains the list of changes and latest version information of each package.

Demonstration

Here is a screenshot of unity-sysfont demo running on Unity Editor. Editor

And here is a picture of the demo (find link above) running on and Android and an iPhone. Android and iPhone

Creating dynamic text

  • Make sure your camera is will configured (normally you will want an orthographic camera).
  • Create an empty GameObject: GameObject -> Create Empty
  • Add a SysFontText component: Component -> SysFont -> Text

Understanding the Inspector

The following is an explanation for each field of SysFontText component.

Text

Type in anything you want (multiline text is OK).

Font Size

The font size used to display the text in all platforms. If 0, the system's default font size will be chosen during runtime.

Bold

Check to use bold.

Note 1: On iOS/MacOSX you can only use this if you leave the font name blank or the font doesn't exist.

Note 2: On Android, you can only use this if the font supports it (if it does not, it will be ignored).

Italic

Check to use italic.

Note 1: On iOS/MacOSX you can only use this if you leave the font name blank or the font doesn't exist.

Note 2: On MacOSX, if both bold and italic are checked, italic will be ignored.

Note 3: On Android, you can only use this if the font supports it (if it does not, it will be ignored).

Alignment

Choose the desired text alignment: left, center, or right.

iOS/MacOSX/Editor Font

The font name to be used on iOS/MacOSX. Leave this field blank to use the system's default font.

Note: In order to safely choose a font name that works equally well for both iOS and MacOSX/Editor, type in the font's "PostScript Name". You can, confirm this by opening /Applications/Font Book, selecting the desired font, and then finally choosing Preview -> Show Font Info for displaying the "PostScript Name" of the font.

Android Font

The font name to be used on Android (eg. Droid Sans, Droid Sans Fallback, etc.). Leave this field blank to use the system's default font.

Multi Line

Check this field to enable multiline text. If you uncheck this and your text contains newlines, the whole text will be displayed as a single line.

Max Width

unity-sysfont generates a texture for each dynamic text component you use. If the text you want to show is wider in pixels than this value, the text will be wrapped.

Note: the default value is 2048 pixels. You don't need to worry about choosing a smaller value, because unity-sysfont will do that automatically for you in runtime: the size of the generated textures will always be the minimum size necessary to contain your text, except if it is bigger than this value.

Max Height

unity-sysfont generates a texture for each dynamic text component you use. If the text you want to show is taller in pixels than this value, the text will be cropped.

Note: the default value is 2048 pixels. You don't need to worry about choosing a smaller value, because unity-sysfont will do that automatically for you in runtime: the size of the generated textures will always be the minimum size necessary to contain your text, except if it is bigger than this value.

Font Color

Choose the color you want for your text.

Pivot

Choose the pivot point for the mesh that is textured with your dynamic text.

Pixel Perfect Text

For displaying pixel perfect text, you can freely use and modify the script PixelPerfectResizer.cs and use it like in the demo (find link above).

NGUI Compatibility

If you wish to use unity-sysfont text with clipping support, you can download the NGUI compatibility package (find link above).

After downloading the package, import it to your project. To add a UISysFontLabel widget to your scene access the menu NGUI -> Create a SysFont Label.

Here is a screenshot of unity-sysfont-ngui. NGUI

Known Problems

On the Unity Editor, sometimes the contents of the textures that are used for displaying the dynamic text get "wiped out". Replaying the scene will most times fix this glitch. This problem does not happen on iOS/Android, so I believe it may be related to the multi-threaded rendering feature that is used on Unity. I am investigating this problem, and I hope to fix it ASAP.

Limitations

  • unity-sysfont is not currently supported on Windows (I have plans to support it in the near future). Keep in touch!
  • Due to the limitations on the webplayer platform, unity-sysfont may never be possible on such platform.

Contribute

  • Found a bug?
  • Want to contribute and add a new feature?

Please fork this project and send me a pull request!

License

unity-sysfont is licensed under the MIT license:

www.opensource.org/licenses/MIT

Copyright

Copyright (c) 2012 Mario Freitas. See LICENSE.txt for further details.

More Repositories

1

mobiledevice

Command line utility for interacting with Apple's Private (Closed) Mobile Device Framework
C++
672
star
2

go-libav

Go language bindings for ffmpeg libraries
Go
522
star
3

gcp-iap-auth

A simple server implementation and package in Go for helping you secure your web apps running on GCP behind a Cloud IAP (Identity-Aware Proxy)
Go
87
star
4

go-observer

Go package for simplifying channel-based broadcasting of events from multiple publishers to multiple observers
Go
86
star
5

cukunity

cukunity is an automation/testing framework that simplifies BDD testing of Unity 3D games.
Ruby
81
star
6

go-loggers-bench

Benchmarking logging libraries for Go
Go
53
star
7

go-interpol

interpol is a Go package for doing format-string like string interpolation using named parameters.
Go
43
star
8

unity-urlclient

HTTP/HTTPS client for Unity (iOS/Android/MacOSX)
C#
36
star
9

gostudy

Go study session presentation at CyberAgent
Go
25
star
10

go-ttlmap

go-ttlmap is a Go package that provides an in-memory key-value cache with notification events for storing TTL-based expirable items.
Go
24
star
11

go-task

Go utility package for simplifying execution of tasks
Go
16
star
12

unity-countly

A Unity3D plugin for facilitating integration with Countly (http://count.ly) Mobile Analytics
C#
13
star
13

dotfiles

dotfiles
Shell
6
star
14

node-resource-pool

Resource pool class for node
JavaScript
5
star
15

gocon

GoConf (golang conference)
Go
3
star
16

hunt-reaktor

hunt.reaktor.com challenge
Perl 6
3
star
17

imkira.github.com

2
star
18

fastest

fastest is a GUI testing framework
Ruby
1
star
19

fluent-plugin-event-tail

fluentd input plugin derived from in_tail and inspired by in_forward for reading [tag, time, record] messages from a file
Ruby
1
star
20

three7-html5

HTML5/Canvas falling-blocks game inspired by a similar game featured in YuYu Hakusho anime
JavaScript
1
star