Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Mar 14, 2017
1 parent 4b96382 commit 791eb54
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions Fonts/Fs.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
<?php
namespace Df\GoogleFont\Fonts;
use Df\GoogleFont\Font\Variant\Preview\Params;
class Fs extends \Df\Core\O {
// 2015-12-08
class Fs {
/**
* 2015-12-08
* @param string[] $relativeParts
* @return string
*/
function absolute(array $relativeParts) {
return $this->baseAbsolute() . df_cc_path($relativeParts);
}
function absolute(array $relativeParts) {return $this->baseAbsolute() . df_cc_path($relativeParts);}

/**
* 2015-12-08
* @return string
*/
function nameColorsSizeMargin() {
if (!isset($this->{__METHOD__})) {
$this->{__METHOD__} = implode('_', [
's' . df_pad0(2, $this->params()->fontSize())
, 'f' . implode('-', $this->params()->fontColor())
, 'b' . implode('-', $this->params()->bgColor())
, 'm' . $this->params()->marginLeft()
]);
}
return $this->{__METHOD__};
}
function nameColorsSizeMargin() {return dfc($this, function() {$p = $this->params(); return
implode('_', [
's' . df_pad0(2, $p->fontSize())
,'f' . implode('-', $p->fontColor())
,'b' . implode('-', $p->bgColor())
,'m' . $p->marginLeft()
])
;});}

/**
* 2015-12-08
Expand All @@ -38,12 +34,9 @@ function namePng(array $params) {return df_fs_name(implode('_', $params)) . '.pn
* 2015-12-08
* @return string
*/
function nameResolution() {
if (!isset($this->{__METHOD__})) {
$this->{__METHOD__} = implode('x', [$this->params()->width(), $this->params()->height()]);
}
return $this->{__METHOD__};
}
function nameResolution() {return dfc($this, function() {$p = $this->params(); return
implode('x', [$p->width(), $p->height()])
;});}

/** @return string */
private function baseAbsolute() {return df_media_path_absolute(self::baseRelative());}
Expand All @@ -53,4 +46,10 @@ private function baseRelative() {return df_cc_path_t('df', 'api', 'google', 'fon

/** @return Params */
private function params() {return Params::fromRequest();}

/**
* 2017-03-15
* @return self
*/
static function s() {static $r; return $r ? $r : $r = new self;}
}

0 comments on commit 791eb54

Please sign in to comment.