Git Product home page Git Product logo

fbdigitalfont's Introduction

FBDigitalFont

Example

This library includes some kind of digital styled font drawer. They're not TTF files or something. They just draw fonts with CoreGraphics. So, you don't need to worry about redistribution license of font files when you release your application.

Example

Bitmap Font

BitmapFont

supporting A-Z, 0-9

LCD Font

LCDFont

supporting 0-9, dash

Square Font

SquareFont

supporting A-Z, 0-9, dash

GLOWING EFFECT

I guess this kind of fonts have high affinity to glowing effects. So I support same effect as FBGlowLabel.

All you have to do is to set 4 properties.

  • glowColor
  • innnerGlowColor
  • glowSize
  • innerGlowSize

APPLICATION EXAMPLE

In my app, "Flashback", Most of digital styled fonts are provided by this technique.

Flashback

For more detail, access to Flashback Calendar

SETTING UP

If you use CocoaPods, add following line into your Podfile

pod 'FBDigitalFont', :git => 'https://github.com/lyokato/FBDigitalFont.git'

or directly git clone or download from this page.

IMPLEMENTATION

This includes some UIView classes which is customized to handle these fonts easily.

  • FBBitmapFontView
  • FBLCDFontView
  • FBSquareFontView

Or If you want, you can directly use drawer classes.

  • FBBitmapFont
  • FBLCDFont
  • FBSquareFont

Each of view classes require you to call resetSize method after modified properties to adjust view size according to modified parameters. Don't forget about this.

FBBitmapFontView

#import <FBDigitalFont/FBBitmapFontView.h>

- (void)setupBitmapFontView
{
    CGRect frame = CGRectMake(10, 60, 300, 50);
    FBBitmapFontView *v = [[FBBitmapFontView alloc] initWithFrame:frame];
    v.text = @"BITMAP";
    v.numberOfBottomPaddingDot = 1;
    v.numberOfTopPaddingDot    = 1;
    v.numberOfLeftPaddingDot   = 2;
    v.numberOfRightPaddingDot  = 2;
    v.glowSize = 20.0;
    v.innerGlowSize = 3.0;
    v.edgeLength = 5.0;
    [self.view addSubview:v];
    [v resetSize];
}
  • dotType
  • edgeLength
  • margin
  • numberOfLeftPaddingDot
  • numberOfTopPaddingDot
  • numberOfRightPaddingDot
  • numberOfBottomPaddingDot
  • numberOfPaddingDotWithinDigits
  • offColor
  • onColor
  • glowColor
  • innerGlowColo
  • glowSize
  • innerGlowSize
  • text

BitmapFontDescription

FBLCDFontView

#import <FBDigitalFont/FBLCDFontView.h>

- (void)setupLCDFontView
{
    CGRect frame = CGRectMake(40, 150, 300, 50);
    FBLCDFontView *v = [[FBLCDFontView alloc] initWithFrame:frame];
    v.text = @"20141231";
    v.lineWidth = 4.0;
    v.drawOffLine = YES;
    v.edgeLength = 20;
    v.margin = 10.0;
    v.backgroundColor = [UIColor blackColor];
    v.horizontalPadding = 20;
    v.verticalPadding = 14;
    v.glowSize = 10.0;
    v.glowColor = UIColorFromRGB(0x00ffff);
    v.innerGlowColor = UIColorFromRGB(0x00ffff);
    v.innerGlowSize = 3.0;
    [self.view addSubview:v];
    [v resetSize];
}
  • drawOffLine
  • edgeLength
  • margin
  • lineWidth
  • horizontalPadding
  • verticalPadding
  • glowSize
  • innerGlowSize
  • lineColor
  • offColor
  • glowColor
  • innerGlowColor
  • text

LCDFontDescription

FBSquareFontView

#import <FBDigitalFont/FBSquareFontView.h>

- (void)setupSquareFontView
{
    CGRect frame = CGRectMake(10, 240, 300, 50);
    FBSquareFontView *v = [[FBSquareFontView alloc] initWithFrame:frame];
    v.text = @"SQUARE";
    v.lineWidth = 3.0;
    v.lineCap = kCGLineCapRound;
    v.lineJoin = kCGLineJoinRound;
    v.margin = 12.0;
    v.backgroundColor = [UIColor blackColor];
    v.horizontalPadding = 30;
    v.verticalPadding = 14;
    v.glowSize = 10.0;
    v.glowColor = UIColorFromRGB(0x00ffff);
    v.innerGlowColor = UIColorFromRGB(0x00ffff);
    v.lineColor = UIColorFromRGB(0xffffff); // 0xffdd66
    v.innerGlowSize = 2.0;
    v.verticalEdgeLength = 12;
    v.horizontalEdgeLength = 14;
    [self.view addSubview:v];
    [v resetSize];
}

  • horizontalEdgeLength
  • verticalEdgeLength
  • margin
  • lineWidth
  • horizontalPadding
  • verticalPadding
  • glowSize
  • innerGlowSize
  • lineJoin
  • lineCap
  • lineColor
  • glowColor
  • innerGlowColor
  • text

SEE ALSO

If you don't need digital font but glowing effect, See FBGlowLabel

FBGlowLabelImage

FOR MORE DETAIL

This repository includes demo project, so you can dig into it for more detail.

fbdigitalfont's People

Contributors

lyokato avatar

Watchers

Kitsion 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.