Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nazmulpcc committed Mar 1, 2017
1 parent f95cb28 commit 07a3fd5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# DON'T BE A DICK PUBLIC LICENSE

> Version 1.1, December 2016
> DON'T BE A DICK PUBLIC LICENSE
> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1. Do whatever you like with the original work, just don't be a dick.

Being a dick includes - but is not limited to - the following instances:

1a. Outright copyright infringement - Don't just copy this and change the name.
1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick.
1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick.

2. If you become rich through modifications, related works/services, or supporting the original work,
share the love. Only a dick would make loads off this work and not buy the original work's
creator(s) a pint.

3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes
you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back.
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
"name": "nazmulpcc/texter",
"description": "A PHP class which makes it easier to write Bangla text on images. Supports multi-line, align etc.",
"type": "library",
"license": "MIT",
"license": "DBAD",
"authors": [
{
"name": "Nazmul Alam",
"email": "nazmulpcc@gmail.com"
}
],
"require": {
"php": "^5.3.3 || ^7.0",
"mirazmac/unicode2bijoy": "1.*"
},

"autoload": {
"psr-4": { "nazmulpcc\\": "src/" }
},

"minimum-stability": "dev",
"suggest": {
"ext-gd": "to use GD library based image processing."
}
Expand Down
33 changes: 19 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Texter helps to write Bangla/English text on image with PHP GD. It also has feat
$texter->startFrom(50, 90)->width(400)->on($image)->align('center')->fontSize(30)->color('333333');
$texter->text('আমার সোনার বাংলা, আমি তোমায় ভালবাসি Lorem ipsum dolor sit amet.....')->write();
```
It will give you something like this:
It will give you something like this:
![Result](http://i.imgur.com/phfgEqy.jpg "Result")

## Installation
Expand All @@ -21,25 +21,30 @@ You can easily install **Texter** via composer or you can manually download the
### Manual
- Download/Clone this repo.
- Download/Clone [mirazmac/Unicode2Bijoy](https://github.com/mirazmac/Unicode2Bijoy) .
- Include Texter.php and Unicode2Bijoy.php in your code and you are ready to go.
- Include **Texter.php** and **Unicode2Bijoy.php** in your code and you are ready to go.

## Documentation
Each method is fairly well documented in the source code. A few important methods:
** startFrom(x, y): ** Set up the co-ordinates from which Texter will start writing.
** width($w): ** Width of the boundary inside which Texter will write text.
** align($position): ** Set the horizontal alignment to left, right or center/centre. Default is left.
** on($image) ** / ** image($image): ** Set the image on which Texter will write. Image is passed by reference.
** fontSize($size): ** Set the font size. $size can be point or pixel, like ```$texter->fontSize('15pt')``` or ```$texter->fontSize('15px'). If 'pt' or 'px' is absent, the gd default is used.
Each method is fairly well documented in the source code. A few important methods:
** startFrom(x, y): ** Set up the co-ordinates from which Texter will start writing.
** width($w): ** Width of the boundary inside which Texter will write text.
** align($position): ** Set the horizontal alignment to left, right or center/centre. Default is left.
** on($image) ** / ** image($image): ** Set the image on which Texter will write. Image is passed by reference.
** fontSize($size): ** Set the font size. $size can be point or pixel, like ```$texter->fontSize('15pt')``` or ```$texter->fontSize('15px'). If 'pt' or 'px' is absent, the gd default is used.
** color($hex): ** / ** color($red, $green, $blue): ** Both hex and RGB are accepted as text color.
** text($text): ** Add text to be written.
** lineHeight($height): ** The line height. $height can be in pixel or as a percentage of the text height.
** write(): ** Call this guy to do the job or if you want to start a new line.
All public functions can be chained up. So you can always do things like:
``` $texter->startFrom(10, 10)->color(0, 0, 0)->align('center')->width(500)->text('Hellow World')->write() ```
**Note: ** Before you write a piece of text, you must at least set the starting points(**startFrom**), **width**, and **image**.
** text($text): ** Add text to be written.
** lineHeight($height): ** The line height. $height can be in pixel or as a percentage of the text height.
** write(): ** Call this guy to do the job or if you want to start a new line.
All public functions can be chained up. So you can always do things like:
``` $texter->startFrom(10, 10)->color(0, 0, 0)->align('center')->width(500)->text('Hellow World')->write() ```
**Note: ** Before you write a piece of text, you must at least set the starting points(**startFrom**), **width**, and **image**.

## About Texter
I developed this out of pure frustration that PHP, one of the most widely used coding language doesn't support Bangla because GD can't handle complex fonts. There are room for a lot of improvements which I will try to accomplish gradually. Please contribute if you can.

## To-Do
- Add vertical alignment feature.
- Support for Text shadow.
- Add some debugging functions
etc.
## License
This project is lincensed under [DBAD](http://www.dbad-license.org) license.

0 comments on commit 07a3fd5

Please sign in to comment.