├── LICENSE.txt ├── MANIFEST ├── MANIFEST.in ├── README.md ├── dist └── pythonWordArt-0.9.tar.gz ├── examples ├── demo-aqua.png ├── demo-arc.png ├── demo-basic-stack.png ├── demo-blues.png ├── demo-brown-stack.png ├── demo-chrome.png ├── demo-gray-block.png ├── demo-graydient.png ├── demo-green-marble.png ├── demo-green-stack.png ├── demo-horizon.png ├── demo-inverted-arc.png ├── demo-italic-outline.png ├── demo-marble-slab.png ├── demo-mauve.png ├── demo-outline.png ├── demo-paper-bag.png ├── demo-purple.png ├── demo-radial.png ├── demo-rainbow.png ├── demo-red-blue.png ├── demo-slate.png ├── demo-squeeze.png ├── demo-stack-3d.png ├── demo-sunset.png ├── demo-superhero.png ├── demo-texture-stack.png ├── demo-tilt.png ├── demo-up.png └── demo-yellow-dash.png ├── pythonWordArt ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-36.pyc │ └── main.cpython-36.pyc ├── css3wordart │ ├── .gitignore │ ├── README.md │ ├── css │ │ ├── fonts │ │ │ ├── MicrosoftSansSerif.eot │ │ │ ├── MicrosoftSansSerif.svg │ │ │ ├── MicrosoftSansSerif.ttf │ │ │ └── MicrosoftSansSerif.woff │ │ └── style.css │ ├── index.html │ └── js │ │ ├── object-observe-lite.js │ │ └── wordart.js ├── example.html └── main.py ├── setup.cfg ├── setup.py ├── temp.png ├── test.py └── upload-to-pypi.sh /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | README.md 3 | setup.cfg 4 | setup.py 5 | pythonWordArt/__init__.py 6 | pythonWordArt/main.py 7 | pythonWordArt/css3wordart/.gitignore 8 | pythonWordArt/css3wordart/README.md 9 | pythonWordArt/css3wordart/gulpfile.js 10 | pythonWordArt/css3wordart/index.html 11 | pythonWordArt/css3wordart/package-lock.json 12 | pythonWordArt/css3wordart/package.json 13 | pythonWordArt/css3wordart/css/style.css 14 | pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.eot 15 | pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.svg 16 | pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.ttf 17 | pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.woff 18 | pythonWordArt/css3wordart/js/object-observe-lite.js 19 | pythonWordArt/css3wordart/js/wordart.js 20 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pythonWordArt/css3wordart/* 2 | include pythonWordArt/css3wordart/css/* 3 | include pythonWordArt/css3wordart/css/fonts/* 4 | include pythonWordArt/css3wordart/js/* 5 | include README.md 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pythonWordArt 2 | 3 | Make WordArt, like the ones in MS Office, using Python3. \ 4 | The actual WordArt generation is performed by a forked version of CSS3 WordArt by Arizzitano (), this Python class is just producing the correct HTML code, rendering it into a Qt widget, and then saving into a PNG image. Basically, the HTML get rendered by a QWebEngineView which is not being shown on screen. Then, the widget contents get stored into a PNG image and cropped in order to oly include the actual WordArt. It's also possible to get a transparent background. 5 | 6 | ## Requirements 7 | * PySide2: https://pypi.org/project/PySide2/ 8 | 9 | If you install pythonWordArt with pip 10 | ``` 11 | pip install pythonWordArt 12 | ``` 13 | the PySide2 library will be installed automatically. Anyway, if you are installing this on a Linux server, you might need to install also these libraries using your package manager: 14 | ``` 15 | sudo apt-get install libgl1-mesa-dri libgl1-mesa-glx libnss3 libfontconfig1 libxcomposite1 libxcursor1 libxi6 libxtst6 libasound2 16 | ``` 17 | you don't need a full Xorg running, just the base libraries. The only problem is that if you don't have a Xorg screen you cannot use the OpenGL effects, so a handful of WordArt styles will not be available. You can check that running the **demo**. 18 | 19 | ## Simple test 20 | 21 | If you run the **main.py** file it will print the name a temporary folder: all the files for the demo will be created in that folder. \ 22 | It's also available a test program that you can run without arguments, or with two arguments. For example, if you want to create an image called **example.png** using the style **rainbow** just run this: 23 | ``` 24 | python3 test.py example.png rainbow 25 | ``` 26 | if you want to know all styles name, please keep reading. 27 | 28 | ## Example code 29 | 30 | This is a minimalistic example: 31 | ``` 32 | from pythonWordArt import pyWordArt 33 | w = pyWordArt() 34 | w.WordArt("Text here", w.Styles["rainbow"], "100") 35 | w.toFile(fileName) 36 | ``` 37 | The first argument is the text, the second is the Style (which needs to be choosen from the **Styles** list, but it's a number from 0 to 29) and the third is the size of the font used to write the WordArt. Usually, 100 is a good value. This gives you a pyWordArt object, that you can then write to an image file (usually in PNG) using the **toFile** function. \ 38 | Alternatively, you can get the image as a Base64 coded text, thanks to the **toBase64** function. \ 39 | It's also possibile to obtain an input-output buffer, useful for libraries that need to open buffers like PIL (pip install Pillow) o Telepot (pip install telepot). For example, it can be used like this: 40 | ``` 41 | from PIL import Image 42 | from pythonWordArt import pyWordArt 43 | w = pyWordArt() 44 | w.WordArt("Text here", w.Styles["rainbow"], "100") 45 | pil_im = Image.open(w.toBufferIO()) 46 | pil_im.show() 47 | ``` 48 | If you specify the **noOpenGL** as **True**, the library will load with minimal graphic support, without an OpenGL context to render 3D effects. If you don't specify this flag, the rendering will be done with OpenGL if available. \ 49 | To try out all the styles, you can run a demo: 50 | ``` 51 | import tempfile 52 | import os 53 | from pythonWordArt import pyWordArt 54 | w = pyWordArt() 55 | # Creating a temporary folder 56 | tmpdirname = "" 57 | with tempfile.TemporaryDirectory() as dirname: 58 | tmpdirname = dirname 59 | os.mkdir(tmpdirname) 60 | print(tmpdirname) 61 | # Set drawing canvas size, optional but recommended 62 | w.canvasWidth = 1754 63 | w.canvasHeight = 1240 64 | # Run the demo 65 | w.demo(tmpdirname, 100) 66 | ``` 67 | It's a good idea to set the canvas size, in particular if you are writing a long text. A note: running the demo, some images might not be written correctly. This happens because some WordArt need some more time, and if you create too many one after the other the QWebEngineView does not have the time to clear its content. This does not happen if you wait between the creation of two WordArt. \ 68 | If you need to get the background transparent, you can set 69 | ``` 70 | w.transparentBackground = True 71 | ``` 72 | before calling the function **WordArt** or **demo**. 73 | 74 | ## Styles 75 | 76 | These are all the available styles: 77 | * outline 78 | * up 79 | * arc 80 | * squeeze 81 | * inverted-arc 82 | * basic-stack 83 | * italic-outline 84 | * slate 85 | * mauve 86 | * graydient 87 | * red-blue 88 | * brown-stack 89 | * radial 90 | * purple 91 | * green-marble 92 | * rainbow 93 | * aqua 94 | * texture-stack 95 | * paper-bag 96 | * sunset 97 | * tilt 98 | * blues 99 | * yellow-dash 100 | * green-stack 101 | * chrome 102 | * marble-slab 103 | * gray-block 104 | * superhero 105 | * horizon 106 | * stack-3d 107 | 108 | You can find all the images in the [examples](https://github.com/zorbaproject/pythonWordArt/tree/master/examples) folder. 109 | 110 | ## List of members 111 | Functions: 112 | 113 | ### init__(self, text = "WordArt Test", style = 15, size = 100, noOpenGL = False) 114 | This function initialize the pythonWordArt object. It's possible to call the function with no argoments, and set the basic properties in the next lines of code. Or you can already set the properties here, which is useful if you just want to get one single wordart. 115 | Does not return a value. 116 | 117 | ### WordArt(self, wordartText, wordartStyle, wordartSize) 118 | This function enables you to set new properties for a WordArt. Basically, you can change the text, the style, or the size all in one line. If you prefer, it's also possible to set the properties manually. 119 | Does not return a value. 120 | 121 | ### toHTML(self, wordartText, wordartStyle, wordartSize) 122 | Returns a string containing html code that works locally displaying the WordArt. 123 | 124 | ### toBase64() 125 | Returns the wordart image as a printable string text in Base64 encoding. 126 | 127 | ### toBufferIO() 128 | Returns an Input Output buffer containing the image. This simulates opening a file withotu actually having to write a file on disk. 129 | 130 | ### toFile(fileName) 131 | Saves the image in a file. The name fileName can be with or without extension. If the extension is missing, PNG format will be used automatically. 132 | Returns full fileName. 133 | 134 | ### demo(self, dirName, wordartSize = 100) 135 | This function take a folder path, and eventually the WordArt size, as arguments. It then creates as many wordart files (in PNG format) as the available Styles. 136 | Does not return a value. 137 | 138 | Properties: 139 | 140 | ### noOpenGL = bool 141 | By default set to False. If set to True, the WordArt creation will be performed without OpenGL, which means some Styles will not look good but you'll be able to use it even if you are running it headless without a GPU. 142 | 143 | ### transparentBackground = bool 144 | By default set to False. If set to True, the WordArt background will become transaprent. If wiriting to a file, please remember to use a format that supports transparency, like PNG. 145 | 146 | ### canvasWidth = int 147 | By default set to 1754, an A4 page width at 150dpi. It is the width in pixels of the canvas where the WordArt will be drawn: you need to set it accordingly to the length of the text you are going to write. In the future, it will be adjusted automatically. 148 | 149 | ### canvasHeight = int 150 | By default set to 1240, an A4 page height at 150dpi. It is the height in pixels of the canvas where the WordArt will be drawn: you need to set it accordingly to the length of the text you are going to write. In the future, it will be adjusted automatically. 151 | 152 | ### text = str 153 | This is the text of the WordArt. Just set whatever you want, but take note that shot texts, less than 3 or 4 words, work best. 154 | 155 | ### style = int 156 | This is the style of the WordArt, by default it's 15, which is the rainbow style. Take a look at the styles list. 157 | 158 | ### size = int 159 | This is the size of the WordArt, by default it's 100. If you need a bigger image, ust use a bigger number. 160 | 161 | ### Styles = dict 162 | This dictionary contains all the styles supported by pythonWordArt. It's easyer to remember the styles by their name nstead of the number. 163 | 164 | ### debug = bool 165 | By default set to False. If set to True, the rendering window (with a QWebEngineView) will be visible, and you'll need to press return to continue after rendering finished. 166 | 167 | ## HTML 168 | 169 | There is a simple [HTML example](https://rawcdn.githack.com/zorbaproject/pythonWordArt/master/pythonWordArt/example.html) in the pythonWordArt folder, of course you need also the css3wordart subfolder to make it work. To change the text, just look for the **wordart-text** span. The content of the span will become the text, and the the **data-text** property will become the shadow. Usually, text and shadow are the same, but you can always use different phrases. 170 | 171 | ## Thanks to 172 | Arizzitano for his WordArt in CSS3+Javascript: https://github.com/arizzitano/css3wordart \ 173 | The Qt Company for PySide2 174 | -------------------------------------------------------------------------------- /dist/pythonWordArt-0.9.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/dist/pythonWordArt-0.9.tar.gz -------------------------------------------------------------------------------- /examples/demo-aqua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-aqua.png -------------------------------------------------------------------------------- /examples/demo-arc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-arc.png -------------------------------------------------------------------------------- /examples/demo-basic-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-basic-stack.png -------------------------------------------------------------------------------- /examples/demo-blues.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-blues.png -------------------------------------------------------------------------------- /examples/demo-brown-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-brown-stack.png -------------------------------------------------------------------------------- /examples/demo-chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-chrome.png -------------------------------------------------------------------------------- /examples/demo-gray-block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-gray-block.png -------------------------------------------------------------------------------- /examples/demo-graydient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-graydient.png -------------------------------------------------------------------------------- /examples/demo-green-marble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-green-marble.png -------------------------------------------------------------------------------- /examples/demo-green-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-green-stack.png -------------------------------------------------------------------------------- /examples/demo-horizon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-horizon.png -------------------------------------------------------------------------------- /examples/demo-inverted-arc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-inverted-arc.png -------------------------------------------------------------------------------- /examples/demo-italic-outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-italic-outline.png -------------------------------------------------------------------------------- /examples/demo-marble-slab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-marble-slab.png -------------------------------------------------------------------------------- /examples/demo-mauve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-mauve.png -------------------------------------------------------------------------------- /examples/demo-outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-outline.png -------------------------------------------------------------------------------- /examples/demo-paper-bag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-paper-bag.png -------------------------------------------------------------------------------- /examples/demo-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-purple.png -------------------------------------------------------------------------------- /examples/demo-radial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-radial.png -------------------------------------------------------------------------------- /examples/demo-rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-rainbow.png -------------------------------------------------------------------------------- /examples/demo-red-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-red-blue.png -------------------------------------------------------------------------------- /examples/demo-slate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-slate.png -------------------------------------------------------------------------------- /examples/demo-squeeze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-squeeze.png -------------------------------------------------------------------------------- /examples/demo-stack-3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-stack-3d.png -------------------------------------------------------------------------------- /examples/demo-sunset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-sunset.png -------------------------------------------------------------------------------- /examples/demo-superhero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-superhero.png -------------------------------------------------------------------------------- /examples/demo-texture-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-texture-stack.png -------------------------------------------------------------------------------- /examples/demo-tilt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-tilt.png -------------------------------------------------------------------------------- /examples/demo-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-up.png -------------------------------------------------------------------------------- /examples/demo-yellow-dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/examples/demo-yellow-dash.png -------------------------------------------------------------------------------- /pythonWordArt/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonWordArt.main import pyWordArt 2 | -------------------------------------------------------------------------------- /pythonWordArt/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/pythonWordArt/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /pythonWordArt/__pycache__/main.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/pythonWordArt/__pycache__/main.cpython-36.pyc -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/README.md: -------------------------------------------------------------------------------- 1 | CSS3 WordArt 2 | ============ 3 | 4 | 1990s MS WordArt. In CSS3. 5 | 6 | View a demo at http://arizzitano.github.io/css3wordart. Note: it's not completely done yet. 7 | 8 | ### WHAT 9 | 10 | WordArt was a feature in older versions of Microsoft Office that generated stylized text. Its wide availability and user-friendliness led to broad use (and abuse) in signage, logos, and presentations. The unique presets are immediately recognizable typographic relics of the late 90s/early 00s. CSS3 WordArt allows users to generate and modify WordArt-like text styled with CSS3. 11 | 12 | CSS3 WordArt is an experimental project developed entirely in Chrome. Any working functionality in other browsers is purely coincidental. 13 | 14 | ### HOW 15 | 16 | I recreated as much of the original WordArt styles as possible using only CSS (LESS, to make things a little more DRY). I harvested source images (available for your perusal in /reference) from the actual WordArt creation interface in a copy of MS Word I ran in a Windows 95 VM. Both pieces of software came from completely legitimate sources, which is obviously why the screenshots are all in Italian. I used the original colors and background tiles, so it's as close as possible as you can get to real WordArt. 17 | 18 | **CSS** 19 | 20 | You might notice that my recreation isn't entirely true to the original. The one thing I couldn't quite reproduce (programmatically, at least) entirely with CSS were curved baselines and bounding boxes. Since CSS3 doesn't support bezier transforms on bounding box edges, I was not able to capture the arched, pinched, wavy, or swoosh shapes applied to some of the WordArt presets. I could probably have done it by applying individual classes to each letter and then applying specific transforms to each one, but that's janky, gross, and unsemantic, and besides, the point of the project was to just do it with CSS. 21 | 22 | CSS3 WordArt will only work in webkit browsers. The primary thing that allows it to work properly is `-webkit-background-clip: text;` which enables the gradient and image backgrounds directly on text. FF doesn't support this property, so it's pretty broken there. Without the gradient and image backgrounds, the styles look a whole lot less like actual WordArt, so I just didn't bother. Apparently there's a way to get around this using SVG, which I'll look into eventually. 23 | 24 | **JS** 25 | 26 | I reproduced most of the WordArt creation interface in addition to the styles, so you can get the full experience. It uses fairly minimal JS that I wrote from scratch. No libraries. I'd call it vanilla, but there's a fair amount of kink involved. I used Gulp as a build tool, then Gulp became un-trendy. C'est la vie. 27 | 28 | ### WHY 29 | 30 | WordArt is lovably tacky. Like [Comic Sans](http://www.comicsanscriminal.com/) or [Screen Beans](http://www.bitbetter.com/), unmodified WordArt presets are generally associated with technical and design ineptitude. What better way to exercise one's technical and design muscles than by paying tribute to this antithesis of modern trendiness? 31 | 32 | tl;dr: 90s fever, baby. [It's so uncool it's cool again.](http://www.shopjeen.com/products/windows-95-backpack) 33 | 34 | ### WHO 35 | 36 | My name is [Ari](http://twitter.com/arizzitano), I'm a [frontend engineer](http://arizzitano.com), and I'm currently looking for a job. [Get at me](mailto:arizzitano@gmail.com). 37 | -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.eot -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.ttf -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/pythonWordArt/css3wordart/css/fonts/MicrosoftSansSerif.woff -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CSS3 WordArt 5 | 6 | 7 | 8 | 9 | 10 |
11 | 16 |
17 | 18 |
19 |

Welcome

20 |

AWould you like to make some WordArt?

21 |
22 | 23 | 24 |
25 |
26 | 27 | 59 | 60 |
61 |

Edit WordArt Text

62 | 73 |
74 | 75 | 76 | 77 | 78 |
79 |
80 | 81 | 82 |
83 |
84 | 85 |
86 |

WordArt

87 |
88 |
89 | 90 |
91 |
92 |
93 |
94 |
95 | 112 |
113 | 114 | 115 | -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/js/object-observe-lite.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Object.observe "lite" polyfill - v0.2.4 3 | * by Massimo Artizzu (MaxArt2501) 4 | * 5 | * https://github.com/MaxArt2501/object-observe 6 | * 7 | * Licensed under the MIT License 8 | * See LICENSE for details 9 | */ 10 | 11 | // Some type definitions 12 | /** 13 | * This represents the data relative to an observed object 14 | * @typedef {Object} ObjectData 15 | * @property {Map} handlers 16 | * @property {String[]} properties 17 | * @property {*[]} values 18 | * @property {Notifier} notifier 19 | */ 20 | /** 21 | * Function definition of a handler 22 | * @callback Handler 23 | * @param {ChangeRecord[]} changes 24 | */ 25 | /** 26 | * This represents the data relative to an observed object and one of its 27 | * handlers 28 | * @typedef {Object} HandlerData 29 | * @property {Map} observed 30 | * @property {ChangeRecord[]} changeRecords 31 | */ 32 | /** 33 | * @typedef {Object} ObservedData 34 | * @property {String[]} acceptList 35 | * @property {ObjectData} data 36 | */ 37 | /** 38 | * Type definition for a change. Any other property can be added using 39 | * the notify() or performChange() methods of the notifier. 40 | * @typedef {Object} ChangeRecord 41 | * @property {String} type 42 | * @property {Object} object 43 | * @property {String} [name] 44 | * @property {*} [oldValue] 45 | * @property {Number} [index] 46 | */ 47 | /** 48 | * Type definition for a notifier (what Object.getNotifier returns) 49 | * @typedef {Object} Notifier 50 | * @property {Function} notify 51 | * @property {Function} performChange 52 | */ 53 | /** 54 | * Function called with Notifier.performChange. It may optionally return a 55 | * ChangeRecord that gets automatically notified, but `type` and `object` 56 | * properties are overridden. 57 | * @callback Performer 58 | * @returns {ChangeRecord|undefined} 59 | */ 60 | 61 | Object.observe || (function(O, A, root, _undefined) { 62 | "use strict"; 63 | 64 | /** 65 | * Relates observed objects and their data 66 | * @type {Map>} 72 | */ 73 | handlers, 74 | 75 | defaultAcceptList = [ "add", "update", "delete", "reconfigure", "setPrototype", "preventExtensions" ]; 76 | 77 | // Functions for internal usage 78 | 79 | /** 80 | * Checks if the argument is an Array object. Polyfills Array.isArray. 81 | * @function isArray 82 | * @param {?*} object 83 | * @returns {Boolean} 84 | */ 85 | var isArray = A.isArray || (function(toString) { 86 | return function (object) { return toString.call(object) === "[object Array]"; }; 87 | })(O.prototype.toString), 88 | 89 | /** 90 | * Returns the index of an item in a collection, or -1 if not found. 91 | * Uses the generic Array.indexOf or Array.prototype.indexOf if available. 92 | * @function inArray 93 | * @param {Array} array 94 | * @param {*} pivot Item to look for 95 | * @param {Number} [start=0] Index to start from 96 | * @returns {Number} 97 | */ 98 | inArray = A.prototype.indexOf ? A.indexOf || function(array, pivot, start) { 99 | return A.prototype.indexOf.call(array, pivot, start); 100 | } : function(array, pivot, start) { 101 | for (var i = start || 0; i < array.length; i++) 102 | if (array[i] === pivot) 103 | return i; 104 | return -1; 105 | }, 106 | 107 | /** 108 | * Returns an instance of Map, or a Map-like object is Map is not 109 | * supported or doesn't support forEach() 110 | * @function createMap 111 | * @returns {Map} 112 | */ 113 | createMap = root.Map === _undefined || !Map.prototype.forEach ? function() { 114 | // Lightweight shim of Map. Lacks clear(), entries(), keys() and 115 | // values() (the last 3 not supported by IE11, so can't use them), 116 | // it doesn't handle the constructor's argument (like IE11) and of 117 | // course it doesn't support for...of. 118 | // Chrome 31-35 and Firefox 13-24 have a basic support of Map, but 119 | // they lack forEach(), so their native implementation is bad for 120 | // this polyfill. (Chrome 36+ supports Object.observe.) 121 | var keys = [], values = []; 122 | 123 | return { 124 | size: 0, 125 | has: function(key) { return inArray(keys, key) > -1; }, 126 | get: function(key) { return values[inArray(keys, key)]; }, 127 | set: function(key, value) { 128 | var i = inArray(keys, key); 129 | if (i === -1) { 130 | keys.push(key); 131 | values.push(value); 132 | this.size++; 133 | } else values[i] = value; 134 | }, 135 | "delete": function(key) { 136 | var i = inArray(keys, key); 137 | if (i > -1) { 138 | keys.splice(i, 1); 139 | values.splice(i, 1); 140 | this.size--; 141 | } 142 | }, 143 | forEach: function(callback/*, thisObj*/) { 144 | for (var i = 0; i < keys.length; i++) 145 | callback.call(arguments[1], values[i], keys[i], this); 146 | } 147 | }; 148 | } : function() { return new Map(); }, 149 | 150 | /** 151 | * Simple shim for Object.getOwnPropertyNames when is not available 152 | * Misses checks on object, don't use as a replacement of Object.keys/getOwnPropertyNames 153 | * @function getProps 154 | * @param {Object} object 155 | * @returns {String[]} 156 | */ 157 | getProps = O.getOwnPropertyNames ? (function() { 158 | var func = O.getOwnPropertyNames; 159 | try { 160 | arguments.callee; 161 | } catch (e) { 162 | // Strict mode is supported 163 | 164 | // In strict mode, we can't access to "arguments", "caller" and 165 | // "callee" properties of functions. Object.getOwnPropertyNames 166 | // returns [ "prototype", "length", "name" ] in Firefox; it returns 167 | // "caller" and "arguments" too in Chrome and in Internet 168 | // Explorer, so those values must be filtered. 169 | var avoid = (func(inArray).join(" ") + " ").replace(/prototype |length |name /g, "").slice(0, -1).split(" "); 170 | if (avoid.length) func = function(object) { 171 | var props = O.getOwnPropertyNames(object); 172 | if (typeof object === "function") 173 | for (var i = 0, j; i < avoid.length;) 174 | if ((j = inArray(props, avoid[i++])) > -1) 175 | props.splice(j, 1); 176 | 177 | return props; 178 | }; 179 | } 180 | return func; 181 | })() : function(object) { 182 | // Poor-mouth version with for...in (IE8-) 183 | var props = [], prop, hop; 184 | if ("hasOwnProperty" in object) { 185 | for (prop in object) 186 | if (object.hasOwnProperty(prop)) 187 | props.push(prop); 188 | } else { 189 | hop = O.hasOwnProperty; 190 | for (prop in object) 191 | if (hop.call(object, prop)) 192 | props.push(prop); 193 | } 194 | 195 | // Inserting a common non-enumerable property of arrays 196 | if (isArray(object)) 197 | props.push("length"); 198 | 199 | return props; 200 | }, 201 | 202 | /** 203 | * Sets up the next check and delivering iteration, using 204 | * requestAnimationFrame or a (close) polyfill. 205 | * @function nextFrame 206 | * @param {function} func 207 | * @returns {number} 208 | */ 209 | nextFrame = root.requestAnimationFrame || root.webkitRequestAnimationFrame || (function() { 210 | var initial = +new Date, 211 | last = initial; 212 | return function(func) { 213 | return setTimeout(function() { 214 | func((last = +new Date) - initial); 215 | }, 17); 216 | }; 217 | })(), 218 | 219 | /** 220 | * Sets up the observation of an object 221 | * @function doObserve 222 | * @param {Object} object 223 | * @param {Handler} handler 224 | * @param {String[]} [acceptList] 225 | */ 226 | doObserve = function(object, handler, acceptList) { 227 | var data = observed.get(object); 228 | 229 | if (data) { 230 | performPropertyChecks(data, object); 231 | setHandler(object, data, handler, acceptList); 232 | } else { 233 | data = createObjectData(object); 234 | setHandler(object, data, handler, acceptList); 235 | 236 | if (observed.size === 1) 237 | // Let the observation begin! 238 | nextFrame(runGlobalLoop); 239 | } 240 | }, 241 | 242 | /** 243 | * Creates the initial data for an observed object 244 | * @function createObjectData 245 | * @param {Object} object 246 | */ 247 | createObjectData = function(object, data) { 248 | var props = getProps(object), 249 | values = [], i = 0, 250 | data = { 251 | handlers: createMap(), 252 | properties: props, 253 | values: values, 254 | notifier: retrieveNotifier(object, data) 255 | }; 256 | 257 | while (i < props.length) 258 | values[i] = object[props[i++]]; 259 | 260 | observed.set(object, data); 261 | 262 | return data; 263 | }, 264 | 265 | /** 266 | * Performs basic property value change checks on an observed object 267 | * @function performPropertyChecks 268 | * @param {ObjectData} data 269 | * @param {Object} object 270 | * @param {String} [except] Doesn't deliver the changes to the 271 | * handlers that accept this type 272 | */ 273 | performPropertyChecks = function(data, object, except) { 274 | if (!data.handlers.size) return; 275 | 276 | var props, proplen, keys, 277 | values = data.values, 278 | i = 0, idx, 279 | key, value, ovalue; 280 | 281 | props = data.properties.slice(); 282 | proplen = props.length; 283 | keys = getProps(object); 284 | 285 | // Check for value additions/changes 286 | while (i < keys.length) { 287 | key = keys[i++]; 288 | idx = inArray(props, key); 289 | value = object[key]; 290 | 291 | if (idx === -1) { 292 | addChangeRecord(object, data, { 293 | name: key, 294 | type: "add", 295 | object: object 296 | }, except); 297 | data.properties.push(key); 298 | values.push(value); 299 | } else { 300 | ovalue = values[idx]; 301 | props[idx] = null; 302 | proplen--; 303 | if (ovalue === value ? ovalue === 0 && 1/ovalue !== 1/value 304 | : ovalue === ovalue || value === value) { 305 | addChangeRecord(object, data, { 306 | name: key, 307 | type: "update", 308 | object: object, 309 | oldValue: ovalue 310 | }, except); 311 | data.values[idx] = value; 312 | } 313 | } 314 | } 315 | 316 | // Checks if some property has been deleted 317 | for (i = props.length; proplen && i--;) 318 | if (props[i] !== null) { 319 | addChangeRecord(object, data, { 320 | name: props[i], 321 | type: "delete", 322 | object: object, 323 | oldValue: values[i] 324 | }, except); 325 | data.properties.splice(i, 1); 326 | data.values.splice(i, 1); 327 | proplen--; 328 | } 329 | }, 330 | 331 | /** 332 | * Sets up the main loop for object observation and change notification 333 | * It stops if no object is observed. 334 | * @function runGlobalLoop 335 | */ 336 | runGlobalLoop = function() { 337 | if (observed.size) { 338 | observed.forEach(performPropertyChecks); 339 | handlers.forEach(deliverHandlerRecords); 340 | nextFrame(runGlobalLoop); 341 | } 342 | }, 343 | 344 | /** 345 | * Deliver the change records relative to a certain handler, and resets 346 | * the record list. 347 | * @param {HandlerData} hdata 348 | * @param {Handler} handler 349 | */ 350 | deliverHandlerRecords = function(hdata, handler) { 351 | var records = hdata.changeRecords; 352 | if (records.length) { 353 | hdata.changeRecords = []; 354 | handler(records); 355 | } 356 | }, 357 | 358 | /** 359 | * Returns the notifier for an object - whether it's observed or not 360 | * @function retrieveNotifier 361 | * @param {Object} object 362 | * @param {ObjectData} [data] 363 | * @returns {Notifier} 364 | */ 365 | retrieveNotifier = function(object, data) { 366 | if (arguments.length < 2) 367 | data = observed.get(object); 368 | 369 | /** @type {Notifier} */ 370 | return data && data.notifier || { 371 | /** 372 | * @method notify 373 | * @see http://arv.github.io/ecmascript-object-observe/#notifierprototype._notify 374 | * @memberof Notifier 375 | * @param {ChangeRecord} changeRecord 376 | */ 377 | notify: function(changeRecord) { 378 | changeRecord.type; // Just to check the property is there... 379 | 380 | // If there's no data, the object has been unobserved 381 | var data = observed.get(object); 382 | if (data) { 383 | var recordCopy = { object: object }, prop; 384 | for (prop in changeRecord) 385 | if (prop !== "object") 386 | recordCopy[prop] = changeRecord[prop]; 387 | addChangeRecord(object, data, recordCopy); 388 | } 389 | }, 390 | 391 | /** 392 | * @method performChange 393 | * @see http://arv.github.io/ecmascript-object-observe/#notifierprototype_.performchange 394 | * @memberof Notifier 395 | * @param {String} changeType 396 | * @param {Performer} func The task performer 397 | * @param {*} [thisObj] Used to set `this` when calling func 398 | */ 399 | performChange: function(changeType, func/*, thisObj*/) { 400 | if (typeof changeType !== "string") 401 | throw new TypeError("Invalid non-string changeType"); 402 | 403 | if (typeof func !== "function") 404 | throw new TypeError("Cannot perform non-function"); 405 | 406 | // If there's no data, the object has been unobserved 407 | var data = observed.get(object), 408 | prop, changeRecord, 409 | thisObj = arguments[2], 410 | result = thisObj === _undefined ? func() : func.call(thisObj); 411 | 412 | data && performPropertyChecks(data, object, changeType); 413 | 414 | // If there's no data, the object has been unobserved 415 | if (data && result && typeof result === "object") { 416 | changeRecord = { object: object, type: changeType }; 417 | for (prop in result) 418 | if (prop !== "object" && prop !== "type") 419 | changeRecord[prop] = result[prop]; 420 | addChangeRecord(object, data, changeRecord); 421 | } 422 | } 423 | }; 424 | }, 425 | 426 | /** 427 | * Register (or redefines) an handler in the collection for a given 428 | * object and a given type accept list. 429 | * @function setHandler 430 | * @param {Object} object 431 | * @param {ObjectData} data 432 | * @param {Handler} handler 433 | * @param {String[]} acceptList 434 | */ 435 | setHandler = function(object, data, handler, acceptList) { 436 | var hdata = handlers.get(handler); 437 | if (!hdata) 438 | handlers.set(handler, hdata = { 439 | observed: createMap(), 440 | changeRecords: [] 441 | }); 442 | hdata.observed.set(object, { 443 | acceptList: acceptList.slice(), 444 | data: data 445 | }); 446 | data.handlers.set(handler, hdata); 447 | }, 448 | 449 | /** 450 | * Adds a change record in a given ObjectData 451 | * @function addChangeRecord 452 | * @param {Object} object 453 | * @param {ObjectData} data 454 | * @param {ChangeRecord} changeRecord 455 | * @param {String} [except] 456 | */ 457 | addChangeRecord = function(object, data, changeRecord, except) { 458 | data.handlers.forEach(function(hdata) { 459 | var acceptList = hdata.observed.get(object).acceptList; 460 | // If except is defined, Notifier.performChange has been 461 | // called, with except as the type. 462 | // All the handlers that accepts that type are skipped. 463 | if ((typeof except !== "string" 464 | || inArray(acceptList, except) === -1) 465 | && inArray(acceptList, changeRecord.type) > -1) 466 | hdata.changeRecords.push(changeRecord); 467 | }); 468 | }; 469 | 470 | observed = createMap(); 471 | handlers = createMap(); 472 | 473 | /** 474 | * @function Object.observe 475 | * @see http://arv.github.io/ecmascript-object-observe/#Object.observe 476 | * @param {Object} object 477 | * @param {Handler} handler 478 | * @param {String[]} [acceptList] 479 | * @throws {TypeError} 480 | * @returns {Object} The observed object 481 | */ 482 | O.observe = function observe(object, handler, acceptList) { 483 | if (!object || typeof object !== "object" && typeof object !== "function") 484 | throw new TypeError("Object.observe cannot observe non-object"); 485 | 486 | if (typeof handler !== "function") 487 | throw new TypeError("Object.observe cannot deliver to non-function"); 488 | 489 | if (O.isFrozen && O.isFrozen(handler)) 490 | throw new TypeError("Object.observe cannot deliver to a frozen function object"); 491 | 492 | if (acceptList === _undefined) 493 | acceptList = defaultAcceptList; 494 | else if (!acceptList || typeof acceptList !== "object") 495 | throw new TypeError("Third argument to Object.observe must be an array of strings."); 496 | 497 | doObserve(object, handler, acceptList); 498 | 499 | return object; 500 | }; 501 | 502 | /** 503 | * @function Object.unobserve 504 | * @see http://arv.github.io/ecmascript-object-observe/#Object.unobserve 505 | * @param {Object} object 506 | * @param {Handler} handler 507 | * @throws {TypeError} 508 | * @returns {Object} The given object 509 | */ 510 | O.unobserve = function unobserve(object, handler) { 511 | if (object === null || typeof object !== "object" && typeof object !== "function") 512 | throw new TypeError("Object.unobserve cannot unobserve non-object"); 513 | 514 | if (typeof handler !== "function") 515 | throw new TypeError("Object.unobserve cannot deliver to non-function"); 516 | 517 | var hdata = handlers.get(handler), odata; 518 | 519 | if (hdata && (odata = hdata.observed.get(object))) { 520 | hdata.observed.forEach(function(odata, object) { 521 | performPropertyChecks(odata.data, object); 522 | }); 523 | nextFrame(function() { 524 | deliverHandlerRecords(hdata, handler); 525 | }); 526 | 527 | // In Firefox 13-18, size is a function, but createMap should fall 528 | // back to the shim for those versions 529 | if (hdata.observed.size === 1 && hdata.observed.has(object)) 530 | handlers["delete"](handler); 531 | else hdata.observed["delete"](object); 532 | 533 | if (odata.data.handlers.size === 1) 534 | observed["delete"](object); 535 | else odata.data.handlers["delete"](handler); 536 | } 537 | 538 | return object; 539 | }; 540 | 541 | /** 542 | * @function Object.getNotifier 543 | * @see http://arv.github.io/ecmascript-object-observe/#GetNotifier 544 | * @param {Object} object 545 | * @throws {TypeError} 546 | * @returns {Notifier} 547 | */ 548 | O.getNotifier = function getNotifier(object) { 549 | if (object === null || typeof object !== "object" && typeof object !== "function") 550 | throw new TypeError("Object.getNotifier cannot getNotifier non-object"); 551 | 552 | if (O.isFrozen && O.isFrozen(object)) return null; 553 | 554 | return retrieveNotifier(object); 555 | }; 556 | 557 | /** 558 | * @function Object.deliverChangeRecords 559 | * @see http://arv.github.io/ecmascript-object-observe/#Object.deliverChangeRecords 560 | * @see http://arv.github.io/ecmascript-object-observe/#DeliverChangeRecords 561 | * @param {Handler} handler 562 | * @throws {TypeError} 563 | */ 564 | O.deliverChangeRecords = function deliverChangeRecords(handler) { 565 | if (typeof handler !== "function") 566 | throw new TypeError("Object.deliverChangeRecords cannot deliver to non-function"); 567 | 568 | var hdata = handlers.get(handler); 569 | if (hdata) { 570 | hdata.observed.forEach(function(odata, object) { 571 | performPropertyChecks(odata.data, object); 572 | }); 573 | deliverHandlerRecords(hdata, handler); 574 | } 575 | }; 576 | 577 | })(Object, Array, this); 578 | -------------------------------------------------------------------------------- /pythonWordArt/css3wordart/js/wordart.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | var CLASSES = [ 3 | 'outline','up','arc','squeeze','inverted-arc','basic-stack', 4 | 'italic-outline','slate','mauve','graydient','red-blue','brown-stack', 5 | 'radial','purple','green-marble','rainbow','aqua','texture-stack', 6 | 'paper-bag','sunset','tilt','blues','yellow-dash','green-stack', 7 | 'chrome','marble-slab','gray-block','superhero','horizon','stack-3d' 8 | ]; 9 | var BG_SPEED = 3; 10 | 11 | function Gallery (p) { 12 | this.el = document.querySelector('.gallery'); 13 | this.parentObject = p; 14 | this.wordArtObj = null; 15 | this.selectedStyle = CLASSES[0]; 16 | } 17 | 18 | Gallery.prototype.render = function () { 19 | var self = this; 20 | var target = self.el.querySelector('#galleryThumbs'); 21 | var template = self.el.querySelector('#galleryTemplate'); 22 | var stacked = self.el.querySelector('#galleryStackedTemplate'); 23 | CLASSES.forEach(function (c, i) { 24 | var tmpl = ((i+1) % 6 === 0) ? stacked : template; 25 | var clone = tmpl.content.cloneNode(true); 26 | var li = clone.querySelector('li'); 27 | li.setAttribute('data-style', c); 28 | [].forEach.call(li.querySelectorAll('.wordart'), function (n) { 29 | n.className = n.className + ' ' + c; 30 | }); 31 | li.addEventListener('click', function (e) { 32 | self.selectStyle(c, this); 33 | }); 34 | target.appendChild(clone); 35 | }); 36 | }; 37 | 38 | Gallery.prototype.selectStyle = function (style, el) { 39 | this.selectedStyle = style; 40 | var currSelected = el.parentNode.querySelector('.selected'); 41 | if (currSelected != null) { 42 | currSelected.className = currSelected.className.replace('selected', ''); 43 | } 44 | el.className = el.className + ' selected'; 45 | }; 46 | 47 | Gallery.prototype.open = function (w) { 48 | this.selectedStyle = CLASSES[0]; 49 | this.wordArtObj = w; 50 | this.el.style.display = 'block'; 51 | }; 52 | 53 | Gallery.prototype.close = function () { 54 | this.el.style.display = 'none'; 55 | this.wordArtObj = null; 56 | }; 57 | 58 | Gallery.prototype.bindHandlers = function () { 59 | var self = this; 60 | self.el.querySelector('button.ok').addEventListener('click', function () { 61 | self.wordArtObj.setStyle(self.selectedStyle); 62 | self.close(); 63 | self.parentObject.launchEditor(); 64 | }); 65 | self.el.querySelector('button.cancel').addEventListener('click', function () { 66 | self.close(); 67 | }); 68 | }; 69 | 70 | Gallery.prototype.init = function () { 71 | this.render(); 72 | this.bindHandlers(); 73 | }; 74 | 75 | 76 | 77 | 78 | function Editor (p) { 79 | this.parentObject = p; 80 | this.wordArtObj = null; 81 | this.el = document.querySelector('.editor'); 82 | this.defaultTxt = 'Your Text Here'; 83 | } 84 | 85 | Editor.prototype.init = function () { 86 | this.bindHandlers(); 87 | }; 88 | 89 | Editor.prototype.open = function (w) { 90 | this.wordArtObj = w; 91 | this.el.querySelector('textarea').value = this.defaultTxt; 92 | this.el.querySelector('textarea').select(); 93 | this.el.style.display = 'block'; 94 | }; 95 | 96 | Editor.prototype.close = function () { 97 | this.el.style.display = 'none'; 98 | this.wordArtObj = null; 99 | }; 100 | 101 | Editor.prototype.bindHandlers = function () { 102 | var self = this; 103 | self.el.querySelector('button.ok').addEventListener('click', function () { 104 | var txt = self.el.querySelector('textarea').value.trim() || this.defaultText(); 105 | self.wordArtObj.setText(txt); 106 | self.close(); 107 | self.parentObject.displayWordArt(); 108 | }); 109 | self.el.querySelector('button.cancel').addEventListener('click', function () { 110 | self.close(); 111 | }); 112 | }; 113 | 114 | 115 | 116 | 117 | function Stage (p) { 118 | this.parentObject = p; 119 | this.el = document.querySelector('.stage'); 120 | this.scr = null; 121 | } 122 | 123 | Stage.prototype.init = function () { 124 | this.open(); 125 | this.bindHandlers(); 126 | }; 127 | 128 | Stage.prototype.open = function () { 129 | this.el.style.display = 'block'; 130 | this.scr = this.el.querySelector('.stage').getBoundingClientRect(); 131 | }; 132 | 133 | Stage.prototype.bindHandlers = function () { 134 | var self = this; 135 | self.el.querySelector('.create').addEventListener('click', function () { 136 | self.parentObject.makeNewWordArt(); 137 | }); 138 | }; 139 | 140 | 141 | 142 | 143 | function Background (p, text, style, fsize) { 144 | this.parentObject = p; 145 | this.el = document.querySelector('.background'); 146 | this.bcr = this.el.getBoundingClientRect(); 147 | this.text = text; 148 | this.wstyle = style; 149 | this.fontSize = fsize; 150 | } 151 | 152 | Background.prototype.init = function () { 153 | this.bindHandlers(); 154 | /*for (var i=0; i 0 && this.position.left < this.availSize('width')) { 246 | this.position.left = newLeft; 247 | } else { 248 | this.dir.x = -this.dir.x; 249 | this.position.left = this.position.left + (this.dir.x * this.speed.x); 250 | } 251 | var newTop = this.position.top + (this.dir.y * this.speed.y); 252 | if (this.position.top > 0 && this.position.top < this.availSize('height')) { 253 | this.position.top = newTop; 254 | } else { 255 | this.dir.y = -this.dir.y; 256 | this.position.top = this.position.top + (this.dir.y * this.speed.y); 257 | } 258 | this.startTimer(); 259 | }; 260 | 261 | BgWordArt.prototype.bindHandlers = function () { 262 | var self = this; 263 | Object.observe(self.position, function (changes) { 264 | changes.forEach(function (c) { 265 | self.el.style[c.name] = c.object[c.name] + 'px'; 266 | }); 267 | }); 268 | }; 269 | 270 | 271 | 272 | 273 | function WordArt (p, s) { 274 | this.verticalStyles = ['basic-stack','brown-stack','green-stack','texture-stack','stack-3d']; 275 | this.parentObject = p; 276 | this.el = document.querySelector('.stage'); 277 | this.stage = s; 278 | 279 | this.selectedStyle, this.txt; 280 | 281 | this.resizable = null; 282 | this.rcr = null; 283 | this.wordArtObj = null; 284 | this.wcr = null; 285 | this.handles = null; 286 | 287 | this.isDragging = false; 288 | this.isResizing = false; 289 | this.resizeHandle = null; 290 | 291 | this.position = { 292 | left: 0, 293 | top: 0, 294 | width: null, 295 | height: null 296 | }; 297 | 298 | this.rescale = { 299 | scale: { 300 | scaleX: 1, 301 | scaleY: 1 302 | }, 303 | size: { 304 | height: null, 305 | width: null 306 | } 307 | }; 308 | } 309 | 310 | WordArt.prototype.setStyle = function (style) { 311 | this.selectedStyle = style; 312 | }; 313 | 314 | WordArt.prototype.setText = function (txt) { 315 | this.txt = txt; 316 | }; 317 | 318 | WordArt.prototype.init = function () { 319 | this.genDeltas(); 320 | this.render(); 321 | this.bindHandlers(); 322 | }; 323 | 324 | WordArt.prototype.render = function () { 325 | var self = this; 326 | var tmpl = self.el.querySelector('#finalWordart'); 327 | var clone = tmpl.content.cloneNode(true); 328 | var wa = clone.querySelector('.wordart'); 329 | var span = wa.querySelector('span'); 330 | wa.className = wa.className + ' ' + self.selectedStyle; 331 | span.setAttribute('data-text', self.txt); 332 | span.innerHTML = self.txt; 333 | 334 | self.resizable = clone.querySelector('.resizable'); 335 | self.wordArtObj = self.resizable.querySelector('.wordart'); 336 | self.handles = self.resizable.querySelectorAll('.h'); 337 | 338 | self.el.querySelector('.stage').appendChild(clone); 339 | setTimeout(function () { 340 | self.initSize(); 341 | }, 5); 342 | }; 343 | 344 | WordArt.prototype.initSize = function () { 345 | this.wcr = this.wordArtObj.getBoundingClientRect(); 346 | this.rcr = this.resizable.getBoundingClientRect(); 347 | this.position.width = (this.wcr.left - this.rcr.left) + 348 | this.wcr.width + 2; 349 | this.position.height = this.wcr.height + 2; 350 | this.rescale.size.height = this.position.height; 351 | this.rescale.size.width = this.position.width; 352 | this.rcr = this.resizable.getBoundingClientRect(); 353 | }; 354 | 355 | WordArt.prototype.move = function (e) { 356 | var newY = parseFloat(this.position.top) + e.movementY; 357 | if (newY > -1 && (newY + this.rcr.height) < this.stage.scr.height) { 358 | this.position.top = newY; 359 | } 360 | var newX = parseFloat(this.position.left) + e.movementX; 361 | if (newX > -1 && (newX + this.rcr.width) < this.stage.scr.width) { 362 | this.position.left = newX; 363 | } 364 | }; 365 | 366 | WordArt.prototype.genDeltas = function () { 367 | var self = this; 368 | [{ 369 | sizeProp: 'width', 370 | posProp: 'left', 371 | axis: 'x', 372 | edgeClass: 'w' 373 | }, { 374 | sizeProp: 'height', 375 | posProp: 'top', 376 | axis: 'y', 377 | edgeClass: 'n' 378 | }].forEach(function (args) { 379 | self['scale' + args.axis] = function (change) { 380 | var self = this; 381 | var classes = self.resizeHandle.className; 382 | var delta = change; 383 | var posDelta = 0; 384 | if (classes.indexOf((args.axis + 'c')) > -1) { 385 | delta = 0; 386 | } else if (classes.indexOf(args.edgeClass) > -1) { 387 | posDelta = delta; 388 | delta = -delta; 389 | } 390 | var newSize = self.rescale.size[args.sizeProp] + delta; 391 | var newPos = self.position[args.posProp] + posDelta; 392 | if ((newPos + newSize) < self.stage.scr[args.sizeProp] && newPos > -1) { 393 | self.position[args.posProp] = newPos; 394 | self.rescale.size[args.sizeProp] = newSize; 395 | } 396 | }; 397 | }); 398 | }; 399 | 400 | WordArt.prototype.resize = function (e) { 401 | this.scalex(e.movementX); 402 | this.scaley(e.movementY); 403 | this.rcr = this.resizable.getBoundingClientRect(); 404 | }; 405 | 406 | WordArt.prototype.bindHandlers = function () { 407 | var self = this; 408 | 409 | // dragging 410 | self.wordArtObj.addEventListener('mousedown', function (e) { 411 | self.isDragging = true; 412 | }); 413 | document.addEventListener('mouseup', function (e) { 414 | self.isDragging = false; 415 | self.isResizing = false; 416 | self.resizeHandle = null; 417 | }); 418 | self.el.addEventListener('mousemove', function (e) { 419 | if (self.isDragging) { 420 | self.move(e); 421 | } else if (self.isResizing) { 422 | self.resize(e); 423 | } 424 | }); 425 | 426 | // resizing 427 | [].forEach.call(self.handles, function (el) { 428 | el.addEventListener('mousedown', function (e) { 429 | self.isResizing = true; 430 | self.resizeHandle = e.target; 431 | }); 432 | }); 433 | 434 | // data change handlers 435 | Object.observe(self.position, function (changes) { 436 | changes.forEach(function (c) { 437 | self.resizable.style[c.name] = c.object[c.name] + 'px'; 438 | }); 439 | }); 440 | Object.observe(self.rescale.size, function (changes) { 441 | changes.forEach(function (c) { 442 | self.rescale.scale.scaleY = c.object.height / self.position.height; 443 | self.rescale.scale.scaleX = c.object.width / self.position.width; 444 | }); 445 | }); 446 | Object.observe(self.rescale.scale, function (changes) { 447 | changes.forEach(function (c) { 448 | ['transform','-webkit-transform','-moz-transform', 449 | '-o-transform','-ms-transform'].forEach(function (prop) { 450 | self.resizable.style[prop] = 'scaleX(' + 451 | c.object.scaleX + ') ' + 452 | 'scaleY(' + c.object.scaleY + ')'; 453 | }); 454 | }); 455 | }); 456 | }; 457 | 458 | WordArt.prototype.close = function () { 459 | this.el.style.display = 'none'; 460 | }; 461 | 462 | 463 | 464 | 465 | function WordArtMaker (text, style, fsize) { 466 | this.background = new Background(this, text, style, fsize); 467 | this.gallery = new Gallery(this); 468 | this.editor = new Editor(this); 469 | this.stage = new Stage(this); 470 | 471 | this.wordArt = null; 472 | this.wordArts = []; 473 | 474 | this.background.init(this); 475 | this.bindHandlers(); 476 | } 477 | 478 | WordArtMaker.prototype.init = function () { 479 | this.gallery.init(this); 480 | this.editor.init(this); 481 | this.stage.init(this); 482 | }; 483 | 484 | WordArtMaker.prototype.makeNewWordArt = function () { 485 | var w = new WordArt(this, this.stage); 486 | this.wordArts.push(w); 487 | this.gallery.open(w); 488 | }; 489 | 490 | WordArtMaker.prototype.launchEditor = function () { 491 | this.editor.open(this.wordArts[this.wordArts.length - 1]); 492 | }; 493 | 494 | WordArtMaker.prototype.displayWordArt = function () { 495 | this.stage.open(); 496 | this.wordArts[this.wordArts.length - 1].init(); 497 | }; 498 | 499 | WordArtMaker.prototype.bindHandlers = function () { 500 | var self = this; 501 | document.querySelectorAll('.welcome button').forEach(button => button.addEventListener('click', function () { 502 | document.querySelector('.welcome').style.display = 'none'; 503 | self.init(); 504 | self.makeNewWordArt(); 505 | })); 506 | }; 507 | 508 | document.addEventListener('DOMContentLoaded', function () { 509 | style = document.getElementById("wordart-style").value; //20; // 0-29 510 | size = document.getElementById("wordart-size").value; //100; 511 | //text = document.getElementById("wordart-text").value; 512 | text = "Prova"; 513 | var w = new WordArtMaker(text, style, size); 514 | document.body.style.backgroundColor = "white"; 515 | }); 516 | }()); 517 | -------------------------------------------------------------------------------- /pythonWordArt/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CSS3 WordArt 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 62 | -------------------------------------------------------------------------------- /pythonWordArt/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | #Python WordArt creator 4 | #by Luca Tringali 5 | #Create images with MS Office WordArt styles, using Python 6 | 7 | #The original "engine" is: 8 | #CSS3 WordArt by Arizzitano: https://github.com/arizzitano/css3wordart 9 | #This Python class is just producing the correct HTML code, converting it into PDF, and then into a PNG image 10 | 11 | #Requirements: 12 | #PySide2: https://pypi.org/project/PySide2/ 13 | 14 | 15 | import sys 16 | import os 17 | import os.path 18 | import time 19 | import tempfile 20 | from subprocess import Popen, PIPE 21 | import io 22 | import base64 23 | 24 | from PySide2.QtWidgets import QApplication, QLabel 25 | from PySide2 import QtCore, QtGui, QtNetwork, QtWebEngineWidgets, QtWidgets 26 | 27 | 28 | class pyWordArt: 29 | def __init__(self, text = "WordArt Test", style = 15, size = 100, noOpenGL = False): 30 | 31 | self.Styles = {'outline' : 0, 'up' : 1, 'arc' : 2, 'squeeze' : 3, 'inverted-arc' : 4, 'basic-stack' : 5, 'italic-outline' : 6, 'slate' : 7, 'mauve' : 8, 'graydient' : 9, 'red-blue' : 10, 'brown-stack' : 11, 'radial' : 12, 'purple' : 13, 'green-marble' : 14, 'rainbow' : 15, 'aqua' : 16,'texture-stack' : 17, 'paper-bag' : 18, 'sunset' : 19, 'tilt' : 20, 'blues' : 21, 'yellow-dash' : 22, 'green-stack' : 23, 'chrome' : 24, 'marble-slab' : 25, 'gray-block' : 26, 'superhero' : 27, 'horizon' : 28, 'stack-3d' : 29} 32 | 33 | self.noOpenGL = noOpenGL 34 | #better safe than sorry 35 | if self.noOpenGL==False and sys.platform != "win32" and sys.platform != "darwin": 36 | if not self.__X_is_running(): 37 | self.noOpenGL = True 38 | 39 | arglist = [sys.argv[0], "--disable-web-security"] 40 | if self.noOpenGL: 41 | arglist.append("-platform") 42 | arglist.append("minimal") 43 | 44 | self.__app = QApplication(arglist) 45 | 46 | #Required properties: 47 | self.text = text 48 | self.size = size 49 | self.style = style 50 | #Optional properties: 51 | self.transparentBackground = False 52 | self.canvasWidth = 1754 #3508 53 | self.canvasHeight = 1240 #2480 54 | self.debug = False 55 | 56 | 57 | def WordArt(self, wordartText, wordartStyle, wordartSize): 58 | self.text = wordartText 59 | self.style = wordartStyle 60 | self.size = wordartSize 61 | 62 | 63 | def toHTML(self, wordartText, wordartStyle, wordartSize): 64 | srcfolder = os.path.abspath(os.path.dirname(__file__)) 65 | myhtml = "" 66 | myhtml = myhtml + "" 67 | myhtml = myhtml + "" 68 | myhtml = myhtml + "CSS3 WordArt" 69 | myhtml = myhtml + "" 70 | myhtml = myhtml + "" 71 | myhtml = myhtml + "" 72 | myhtml = myhtml + "" 73 | myhtml = myhtml + "" 74 | myhtml = myhtml + "" 75 | myhtml = myhtml + "" 76 | myhtml = myhtml + "" 77 | myhtml = myhtml + "" 78 | myhtml = myhtml + "
" 79 | myhtml = myhtml + "" 84 | myhtml = myhtml + "
" 85 | myhtml = myhtml + "" 86 | myhtml = myhtml + "" 87 | return myhtml 88 | 89 | 90 | def toFile(self, filename): 91 | self.imgName = filename 92 | if not bool(self.imgName.endswith(".png") or self.imgName.endswith(".jpg") or self.imgName.endswith(".jpeg") or self.imgName.endswith(".gif") or self.imgName.endswith(".tif") or self.imgName.endswith(".tiff") or self.imgName.endswith(".bmp")): 93 | self.imgName = self.imgName + ".png" 94 | 95 | self.__render() 96 | 97 | return self.imgName 98 | 99 | def toBase64(self): 100 | self.__buffer = QtCore.QBuffer() 101 | self.__buffer.open(QtCore.QBuffer.ReadWrite) 102 | 103 | self.__render() 104 | 105 | b64 = self.__buffer.data().toBase64().data() 106 | return b64 107 | 108 | 109 | def toBufferIO(self): 110 | b64 = self.toBase64() 111 | return io.BytesIO(base64.decodebytes(b64)) 112 | 113 | 114 | def __render(self): 115 | self.__view = QtWebEngineWidgets.QWebEngineView() 116 | self.__view.setFixedSize(self.canvasWidth,self.canvasHeight) 117 | self.__view.loadFinished.connect(self.__grabimage) 118 | 119 | myhtml = self.toHTML(self.text, self.style, self.size) 120 | 121 | self.__view.setHtml(myhtml) 122 | if not self.debug: 123 | self.__view.setAttribute(QtCore.Qt.WA_DontShowOnScreen, True) 124 | self.__view.setAttribute(QtCore.Qt.WA_ShowWithoutActivating, True) 125 | self.__view.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) 126 | self.__view.setAttribute(QtCore.Qt.WA_AlwaysStackOnTop, True) 127 | self.__view.show() 128 | 129 | self.__app.exec_() 130 | 131 | 132 | def __grabimage(self): 133 | if sys.platform == "win32": 134 | QApplication.processEvents() 135 | if self.debug: 136 | test = input("Press return to continue or Ctrl+C to stop") 137 | pixmap = self.__view.grab() 138 | image = self.__cropImage(pixmap.toImage(), self.transparentBackground) 139 | useBuffer = True 140 | try: 141 | if not self.__buffer.isOpen(): 142 | useBuffer = False 143 | except: 144 | useBuffer = False 145 | if useBuffer: 146 | image.save(self.__buffer, "PNG") 147 | time.sleep(0.1) 148 | self.__buffer.close() 149 | else: 150 | image.save(self.imgName) 151 | while not os.path.isfile(self.imgName): 152 | time.sleep(0.1) 153 | time.sleep(0.1) #sometimes we need a little bit more just to be sure the file has actually been written 154 | self.__view.hide() 155 | self.__app.exit() 156 | 157 | 158 | def __cropImage(self, origimage, transparentBackground = False): 159 | maxX = 0 160 | minX = origimage.width() 161 | maxY = 0 162 | minY = origimage.height() 163 | exclusionColor = QtGui.QColor(255, 255, 255, 255) 164 | 165 | for x in range(origimage.width()): 166 | for y in range(origimage.height()): 167 | if QtGui.QColor.fromRgb(origimage.pixel(x, y)) != exclusionColor: 168 | if x < minX: 169 | minX = x 170 | if x > maxX: 171 | maxX = x 172 | if y < minY: 173 | minY = y 174 | if y > maxY: 175 | maxY = y 176 | 177 | if minX > maxX or minY > maxY: 178 | myimage = origimage 179 | else: 180 | myimage = origimage.copy(minX, minY, maxX-minX, maxY-minY) 181 | 182 | if transparentBackground: 183 | newimage = QtGui.QImage(myimage.width(),myimage.height(),QtGui.QImage.Format_ARGB32) 184 | for x in range(myimage.width()): 185 | for y in range(myimage.height()): 186 | tmpcolor = QtGui.QColor.fromRgb(myimage.pixel(x, y)) 187 | if tmpcolor == exclusionColor: 188 | newimage.setPixelColor(x,y,QtGui.QColor(0, 0, 0, 0)) 189 | else: 190 | newimage.setPixelColor(x,y,tmpcolor) 191 | myimage = newimage 192 | return myimage 193 | 194 | 195 | def __X_is_running(self): 196 | try: 197 | #thanks to : https://stackoverflow.com/questions/1027894/detect-if-x11-is-available-python, it's much more clean than my original idea 198 | p = Popen(["xset", "-q"], stdout=PIPE, stderr=PIPE) 199 | p.communicate() 200 | return p.returncode == 0 201 | except: 202 | return False 203 | 204 | 205 | def demo(self, dirName, wordartSize = 100): 206 | if not os.path.isdir(dirName): 207 | print("Not a folder") 208 | return 209 | for elem in self.Styles: 210 | self.WordArt("WordArt Test", self.Styles[elem], wordartSize) 211 | self.toFile(dirName + "/demo-" + elem + ".png") 212 | 213 | 214 | 215 | if __name__ == "__main__": 216 | w = pyWordArt() 217 | tmpdirname = "" 218 | with tempfile.TemporaryDirectory() as dirname: 219 | tmpdirname = dirname 220 | os.mkdir(tmpdirname) 221 | print(tmpdirname) 222 | w.canvasWidth = 1754 223 | w.canvasHeight = 1240 224 | #w.transparentBackground = True 225 | w.demo(tmpdirname, "100") 226 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | # Inside of setup.cfg 2 | [metadata] 3 | description-file = README.md 4 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | with open("README.md", "r") as fh: 4 | long_description = fh.read() 5 | myversion = '0.9' 6 | setup( 7 | name = 'pythonWordArt', 8 | packages = ['pythonWordArt'], 9 | version = myversion, 10 | license='gpl-3.0', 11 | description = 'Make WordArt, like the ones in MS Office, using Python3', 12 | long_description=long_description, 13 | long_description_content_type="text/markdown", 14 | author = 'Luca Tringali', 15 | author_email = 'TRINGALINVENT@libero.it', 16 | url = 'https://github.com/zorbaproject/pythonWordArt', 17 | download_url = 'https://github.com/zorbaproject/pythonWordArt/archive/v'+myversion+'.tar.gz', 18 | keywords = ['wordart', 'html2png', 'office'], 19 | include_package_data=True, 20 | install_requires=[ 21 | 'PySide2', 22 | ], 23 | classifiers=[ 24 | 'Development Status :: 4 - Beta', # either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" 25 | 'Intended Audience :: Developers', 26 | 'Topic :: Software Development :: Build Tools', 27 | 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 28 | 'Programming Language :: Python :: 3', 29 | 'Programming Language :: Python :: 3.6', 30 | 'Programming Language :: Python :: 3.7', 31 | ], 32 | ) 33 | -------------------------------------------------------------------------------- /temp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zorbaproject/pythonWordArt/ae0c096da022bba6f2130d8ce4a611eda6a390d4/temp.png -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import sys 3 | import os.path 4 | from pythonWordArt import pyWordArt 5 | 6 | fileName = "temp2" 7 | if len(sys.argv) >1: 8 | if os.path.isdir(os.path.abspath(os.path.dirname(sys.argv[1]))): 9 | fileName = sys.argv[1] 10 | print(fileName) 11 | 12 | mystyle = "rainbow" 13 | if len(sys.argv) >2: 14 | mystyle = sys.argv[2] 15 | 16 | w = pyWordArt() 17 | w.debug = True 18 | w.WordArt("Text here", w.Styles[mystyle], "100") 19 | w.toFile(fileName) 20 | 21 | try: 22 | from PIL import Image 23 | pil_im = Image.open(w.toBufferIO()) 24 | pil_im.show() 25 | except: 26 | print("Unable to show image") 27 | -------------------------------------------------------------------------------- /upload-to-pypi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | python3 setup.py sdist 3 | twine upload dist/* 4 | --------------------------------------------------------------------------------