Skip to content

Commit

Permalink
Font
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrrill committed Oct 25, 2016
1 parent afbf60f commit b8f9afa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Binary file added fonts/RobotoMono-Regular.ttf
Binary file not shown.
20 changes: 10 additions & 10 deletions src/Namevatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function setMinSize($minSize)
public function getFontFile()
{
if (!$this->fontFile) {
return __DIR__ . '/../fonts/OpenSans-Regular.ttf';
return __DIR__ . '/../fonts/RobotoMono-Regular.ttf';
}

return $this->fontFile;
Expand Down Expand Up @@ -192,15 +192,15 @@ public function generate($letter, $size = null)

return $this;
}

/**
* Generate a 2-letter avatar from a name and return image content
* Background color is consistent, and derived from name initial
*
* @param string $name
* @param string $name
* @param integer $size
* @return $this
*/
*/
public function generateFromName($name, $size = null)
{
$name_initials = '';
Expand All @@ -215,21 +215,21 @@ public function generateFromName($name, $size = null)
$colors = ColorPalette::getColors();
$char_index = ord($name_initials[0]) - 64;
$color_index = $char_index % count($colors);
$color = $colors[$color_index];
$color = $colors[$color_index];

$this->createImage(
$name_initials,
$color,
$this->getSize($size)
);

return $this;
return $this;
}

/**
* @author yohang88/letter-avatar
*/
public function break_words($name)
public function break_words($name)
{
$temp_word_arr = explode(' ', $name);
$final_word_arr = array();
Expand All @@ -239,7 +239,7 @@ public function break_words($name)
}
}
return $final_word_arr;
}
}

/**
* Save as png
Expand Down

0 comments on commit b8f9afa

Please sign in to comment.