Git Product home page Git Product logo

font-attr's Introduction

Web Font Viewer

A simple tool to allow developers, designers, and even producers to visualize the chosen fonts for a project. A little set up by a developer will allow designers to tweak and pass back info to a developer for font implementation. The example is using TypeKit.

Setup

Fork the project and create a new branch from develop. This new branch will serve as the branch you will use for a particular project. The concept being that you can create a branch for each project you may have.

Edit the method of loading your fonts in index.html. Whether you are using Typekit, Google Fonts, typography.com or custom fonts you will be loading these in the head of the index.

Edit the CSS

Create a class for each of the different fonts you will be using and add these to style.css. For example:

.tk-futura-pt-book-italic
{
	font-family: "futura-pt",sans-serif;
	font-style: italic;
	font-weight: 400;
}

You can see this in action in style.css where we have 6 different variations of the same font. Copy all of these classes and then you can add this to the JavaScript in the index file.

Edit the HTML/JavaScript

The fonts variable contains this list of classes so that we can apply the style to the overall container.

The prefix variable is so we can safely remove a class from an element based on a prefix. So you can see that in the example we've prefixed all the font declarations with "tk-futura". You will want to do the same and edit this variable appropriately.

You should also change the class of the <div id="container"> to be the first element in the fonts array. This will, of course, set the default font when the page loads.

Usage

Simple. Place your files somewhere accessible to your localhost. Open the index page in a browser and tinker with the controls. Better yet, in your office you can pass around the URL and allow others to see from their machine. (Check out this tutorial on setting up Virtual Hosts if you're feeling ambitious.)

Advanced

You can click the cog to open a modal window that will present you with a JSON object that describes the current state of the text. This can be passed to a developer and s/he will know what to do with it.

The index file has lorem ipsum but feel free to change this as you see fit. The user can change the text as needed on the fly but if you'd like to start with a particular text, by all means, change it.

Versions

1.1

  • Changed Name
  • Added screenshot for WP

1.1

  • Cleaned JS
  • Added Google fonts example
  • Keeping Typekit as the main example

1.0

  • added ability to have user change text

User can modify the following attributes

  • fontColor
  • bgColor
  • size
  • face
  • lineHeight
  • align
  • transform
  • smoothing (webkit only)
  • letterSpacing
  • rotation
  • spacing (between paragraphs)
  • width (of overall container)

font-attr's People

Watchers

James Cloos avatar Matt Plummer 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.