Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="wrap">
  <div class="kern-more">ما ز یاران چشم یاری داشتیم</div>
</div>
              
            
!

CSS

              
                body {
  direction: rtl;
  margin: 0 auto;
}
.wrap {
  max-width: 1200px;
  margin: 1em auto 0;
  text-align: center;
}
.chain-kern,
.kern,
.kern-more,
.no-kern,
.word-kern {
  font-family: IranNastaliq;
  font-size: 64px;
  margin-bottom: 1em;
}
.kern .plig3 {
  margin-right: -0.05em;
}
.kern .plig5 {
  margin-right: -0.1em;
}
.kern .plig7 {
  margin-right: -0.2em;
  vertical-align: 0.1em;
}
.kern .plig8 {
  margin-right: -0.05em;
  vertical-align: 0.43em;
}
.kern .plig10 {
  margin-right: -0.15em;
}
.kern .plig12,
.kern .plig14 {
  margin-right: -0.2em;
}
.kern .plig14 {
  vertical-align: 0.1em;
}
.kern .plig17 {
  margin-right: -0.05em;
}
.kern .plig18 {
  margin-right: -0.4em;
  vertical-align: 0.2em;
}
.kern-more .plig1 {
  color: #008055;
}
.kern-more .plig3 {
  margin-right: -0.05em;
  color: #008060;
}
.kern-more .plig5 {
  margin-right: -0.1em;
  vertical-align: 0.1em;
  color: #00806b;
}
.kern-more .plig6 {
  color: teal;
}
.kern-more .plig7 {
  margin-right: -0.25em;
  vertical-align: 0.15em;
  color: #007580;
}
.kern-more .plig8 {
  margin-right: -0.1em;
  vertical-align: 0.43em;
  color: #006b80;
}
.kern-more .plig10 {
  margin-right: -0.7em;
  vertical-align: 1.2em;
  color: #005580;
}
.kern-more .plig12 {
  margin-right: -0.5em;
  vertical-align: 1.5em;
  color: #004b80;
}
.kern-more .plig13 {
  margin-right: -0.05em;
  vertical-align: 1.7em;
  color: #004080;
}
.kern-more .plig14 {
  margin-right: -0.4em;
  vertical-align: 2em;
  color: #002b80;
}
.kern-more .plig16 {
  vertical-align: 2.5em;
  margin-right: -0.4em;
  color: #001580;
}
.kern-more .plig17 {
  margin-right: -0.05em;
  vertical-align: 2.5em;
  color: navy;
}
.kern-more .plig18 {
  margin-right: -0.4em;
  vertical-align: 2.8em;
  color: #150080;
}

              
            
!

JS

              
                /*global jQuery */
/*
* Persian-Lettering.JS 1.0.0
* by Mojtaba Taheri (http://mojtaba-taheri.ir)
*/
(function($){
	function injector(t, splitter, klass, after) {
		var text = t.text()
		, a = text.split(splitter)
		, inject = '';
		if (a.length) {
			$(a).each(function(i, item) {
				inject += '<span class="'+klass+(i+1)+'" aria-hidden="true">'+item+'</span>'+after;
			});
			t.attr('aria-label',text)
			.empty()
			.append(inject)

		}
	}


	var methods = {
		init : function() {

			return this.each(function() {
				injector($(this), '', 'char', '');
			});

		},

		//Kerning Persian and Arabic typography are different from latin languages.
		//Some letters are connected to the text letters, some are not.
		//so we have to apply kerning for each LIGATURE instead of each letter.
		//you can divide your Persian or Arabic text to ligatures using the following method:
		pligatures : function() {
			return this.each(function() {
				ptext = $(this).text();
				ptext = ptext.replace(/([آادذرزژو.،:؛؟ ])/g , '$1↔').replace(/([. ])/g, '↔$1').replace(/↔↔/g, '↔');
				injector($(this).text(ptext), '↔', 'plig', '');
			});
		},

		words : function() {

			return this.each(function() {
				injector($(this), ' ', 'word', ' ');
			});

		},

		lines : function() {

			return this.each(function() {
				var r = "eefec303079ad17405c889e092e105b0";
				// Because it's hard to split a <br/> tag consistently across browsers,
				// (*ahem* IE *ahem*), we replace all <br/> instances with an md5 hash
				// (of the word "split").  If you're trying to use this plugin on that
				// md5 hash string, it will fail because you're being ridiculous.
				injector($(this).children("br").replaceWith(r).end(), r, 'line', '');
			});

		}
	};

	$.fn.lettering = function( method ) {
		// Method calling logic
		if ( method && methods[method] ) {
			return methods[ method ].apply( this, [].slice.call( arguments, 1 ));
		} else if ( method === 'letters' || ! method ) {
			return methods.init.apply( this, [].slice.call( arguments, 0 ) ); // always pass an array
		}
		$.error( 'Method ' +  method + ' does not exist on jQuery.lettering' );
		return this;
	};

})(jQuery);



//initialize the persian-lettering.js
$(document).ready(function() {
	    $(".kern").lettering('pligatures');
	    $(".kern-more").lettering('pligatures');
	    $(".chain-kern").lettering('words').children('span').lettering('pligatures');
	  });
              
            
!
999px

Console