Git Product home page Git Product logo

nativefont's Introduction

##Welcome to NativeFont NativeFont is an custom bitmapfont library that is used to create freedom Labels.

####Welcome to join us !!!

About Nativefont

Make Native bitmapFont from Native code. Android Bitmap or IOS UILabel or Desktop Graphics2D

##Features

  • No External ttf
  • Multi-language
  • Cross-platform
  • Convenience
  • Open Source

Requirements

  • Libgdx 1.6+
  • Robovm fork 2.0+
  • MOE 1.1+

##Widget

  • NativeLabel
  • NativeButton
  • NativeTextField
  • NativeTextArea

Usage

allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }
dependencies {
	        compile 'com.github.tianqiujie.nativefont:2.4.3'
	}

In Moe add -keep class net.mwplay.nativefont.** { *; }in proguard.append.cfg

In Robovm

@Override
    protected IOSApplication createApplication() {
        IOSApplicationConfiguration config = new IOSApplicationConfiguration();
        FontTestGame game = new FontTestGame();
        //important!!!
        NativeFont.setRobovm();

        return new IOSApplication(game, config);
    }

add <pattern>net.mwplay.nativefont.*</pattern> in robovm.xml.

Please see the test/FontTest.java

NativeFont font50 = new NativeFont(new NativeFontPaint(50));
        font50.appendText(DEFAULT_CHARS);
        fonts.put("font50", font50);
label = new NativeLabel("", game.fonts.get("font50"), Color.BLACK);
        label.setText(text);
        label.setPosition(pos.x, pos.y);
        stage.addActor(label);
        
NativeLabel nativeLabel = new NativeLabel("as", game.fonts.get("font"));
        nativeLabel.pos(300, 500).color(Color.BLACK).text("xxxxxxx").drag().enableTouch();
        nativeLabel.addTo(stage);

ScreenShot

###Android: Android ###IOS: IOS ###Desktop: Desktop

##Costum Font ####NativeFont can use a costum font by .ttf 1.Placed the .ttf file under the asset folder.

2.In Robovm,Under the ios project, open the info.plist.xml file,in < dict > write the following code behind.

    <key>UIAppFonts</key>
    <array>
        <string>your_file.ttf</string>
    </array>

3.Than you can use ,like this

   NativeFont ttfFont = new NativeFont(new NativeFontPaint("test.ttf"));
   NativeLabel label = new NativeLabel("Hello World",ttfFont,Color.BLACK);

Thanks:

@Var3d: QQ: 348705644 Email: [email protected]         Var3d: http://var3d.net/    

License

NativeFont is licensed under the Apache 2 License, meaning you can use it free of charge, without strings attached in commercial and non-commercial projects.

nativefont's People

Contributors

badboy-tian avatar kirinhorse avatar karamay00 avatar whitecostume avatar

Watchers

James Cloos avatar

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.