Skip to content

This library includes some kind of digital fonts (not TTF or something, just CoreGraphics drawing)

License

Notifications You must be signed in to change notification settings

toms972/FBDigitalFont

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 numberOfPaddingDotsBetweenDigits
  • 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.

About

This library includes some kind of digital fonts (not TTF or something, just CoreGraphics drawing)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 99.3%
  • Ruby 0.7%