sjrsmile
1/4/2017 - 5:30 PM

Referenced in font-size.

Referenced in font-size.

/* -----------------------------------------------------------------------
/* Font sizes
/* -------------------------------------------------------------------- */
@mixin font-size-single( $size, $parent: null, $important: null ) {

	$size     		: px($size);
	$parent   		: px($parent);
	$size_new 		: null;

	@if ($parent != null) {
		$size_new : $size / $parent;
	}
	@else {
		$size_new : $size / 16px;
	}

	$important-added	: "";
	@if ( $important != null ) {
		$important-added	: "!important";
	}



	font-size : $size #{$important-added};
	font-size : em($size_new) #{$important-added};
} // font-size-single






@mixin font-size( $max, $important: null, $max-parent: null, $min-parent: null, $min: null ) {

	// sort correct units

	// max
	$max-px						: px( $max );
	$max-em    				: em( $max );
	$max-unitless  		: nounit( px( $max-px ) );


	// min - unique font-size
	$min-px  				: px( $p_size_mobile );
	$min-em 		 		: em( $p_size_mobile );
	$min-unitless		: nounit( px( $min-px ) );

	// min
	@if ( $min != null ) {
		$min-px  				: px( $min );
		$min-em  				: em( $min );
		$min-unitless		: nounit( px( $min-px ) );
	}

	// fix parent
	@if( $max-parent != null ) {
		$min-em					: em( $min-px / $max-parent );
	}

	// media size
	$min_vw-px  			: px( $mobile );
	$min_vw-em  			: em( $mobile );
	$min_vw-unitless 	: nounit( px( $mobile ) );

	// media size
	$max_vw-px  			: px( $desktop );
	$max_vw-em  			: em( $desktop );
	$max_vw-unitless 	: nounit( px( $desktop ) );

	$maxmax_vw-em  		: em( $max-desktop );
	$maxmax_vw-unitless : nounit( px( $max-desktop ) );

	$important-added	: "";
	@if ( $important != null ) {
		$important-added	: "!important";
	}



	@include font-size-single( $min-px, $min-parent, $important );

	@media ( min-width: #{$min_vw-em} ) and ( max-width: #{$maxmax_vw-em} ) {

		font-size:          calc( #{$min-em} + (#{$max-unitless} - #{$min-unitless}) * ( (100vw - #{$min_vw-px}) / ( #{$maxmax_vw-unitless} - #{$min_vw-unitless}) ) ) #{$important-added};
		font-size:     -moz-calc( #{$min-em} + (#{$max-unitless} - #{$min-unitless}) * ( (100vw - #{$min_vw-px}) / ( #{$maxmax_vw-unitless} - #{$min_vw-unitless}) ) ) #{$important-added};
		font-size:  -webkit-calc( #{$min-em} + (#{$max-unitless} - #{$min-unitless}) * ( (100vw - #{$min_vw-px}) / ( #{$maxmax_vw-unitless} - #{$min_vw-unitless}) ) ) #{$important-added};
	}

	@media ( min-width: #{$max_vw-em} ) {
		@include font-size-single( $max-px, $max-parent, $important );
	}

} // font-size