Commit graph

99 commits

Author SHA1 Message Date
Bill Kendrick
33db4c16f5 WIP Changes to support building for OS/2
+ WIP Makefile updates to support building for OS/2
   - TODO: Makefile needs SYSNAME test to detect OS/2 (Bill has asked Elbert)
 + Added "__declspec(dllexport)" (via new "TX_EXTERN" #define'd in
   `tp_magic_api.h`) to public function definitions in Magic tools
   - WIP: So far just "Mirror/Flip" plugin
   - TODO: Add "TX_EXTERN" prefix to all other public Magic tool functions
 + Renamed long Magic tool source files to have shorter filenames
   - WIP: So far just "Mirror/Flip" (`mirror_flip.c` -> `mirror_f.c`)
   - TODO: Rename all other magic tool source files.

h/t Elbert Pol for providing info and some diffs!
2024-06-06 00:40:42 -07:00
Bill Kendrick
5bdbc2766b Ran indent.sh to re-indent all source files 2024-05-10 00:26:10 -07:00
dolphin6k
d271c5ba42 Default locale font for Japanese 2023-07-02 16:56:03 +09:00
Bill Kendrick
323ba42f9d Add _POSIX_PRIORITY_SCHEDULING to fonts.c for Haiku
h/t Luc
2023-06-29 21:51:53 -07:00
Bill Kendrick
342630cb9d family_info.filename is an array; index into it!
h/t Shin-ichi for reporting the warning

  warning: the comparison will always evaluate as 'true' for the address
  of 'filename' will never be NULL [-Waddress]
2023-06-21 22:52:32 -07:00
Bill Kendrick
fc2e7d1302 Another cast TTF_FontFaceFamilyName from ...
... const char * to char *

Trying to avoid warning Shin-ichi reported

warning: assignment discards 'const' qualifier from pointer target type
2023-06-21 22:48:51 -07:00
Bill Kendrick
38b9dc657f More info in fonts.c re: locale fonts (fallbacks) 2023-06-13 22:08:33 -07:00
Bill Kendrick
104c27086b Bump some file update dates! 2023-06-13 00:27:50 -07:00
Bill Kendrick
0437b898ca Allow primary & fallback locale fonts to be specified
e.g., for Chinese Traditional, try to use the full font (that
we supply as an optional download), then try the 'subset' font
that we ship with Tux Paint.
2023-06-13 00:25:49 -07:00
Bill Kendrick
0bfc8c18c1 Looks like SDL2_Pango can find our fonts now
Made sure to add our font dir (e.g., /usr/local/share/tuxpaint/fonts/)
to FontConfig's directories before trying to load uifont!

Also, update font names to match what we ship with Tux Paint.
WIP -- Would like to supply some alternatives.
2023-06-12 23:51:07 -07:00
Mark Kim
fcba197c90 default font for Korean 2023-06-13 00:00:20 -04:00
Bill Kendrick
1d212475b9 More locale font defaults
Based on what we have as plain TTF files in the repo,
and what's available in Ubuntu.
2023-06-08 01:28:20 -07:00
Bill Kendrick
3c8f25e6e9 Ability to specify fonts on a per-locale basis
Add to the list found in `src/fonts.c` (use language IDs
found in `src/i18n.h`, e.g. "LANG_DE" for German).
h/t Shin-ichi for the suggestion

Closes https://sourceforge.net/p/tuxpaint/feature-requests/240/
2023-06-08 00:40:43 -07:00
Bill Kendrick
1b6ee72e87 "uifont" option: tell us what we wanted & what we got
The requested font & actual font loaded will be echo'd to STDOUT
when specifying the `uifont` option.

This uses Pango library directly (I was unable to convice SDL2_Pango.h
to actually notice that pango.h was #include'd before it, and expose
its SDLPango_GetPangoFontDescription() function!).  This is okay,
since we want to also add a "--uifont list" option (or similar),
that will list all of the available fonts, if a user wishes to
query them.  (And similar code will be added to tuxpaint-config to make
the setting available as a pull-down, rather than (or as well as) a
freeform type-in field.)
2023-06-01 00:20:41 -07:00
Bill Kendrick
cef773a694 Now REQUIRING SDL2_Pango; no NO_SDLPANGO option
Motivation - Without SDL2_Pango, languages like Japanese,
Arabic, and Thai do not render properly.  Currently, Debian
(and hence Ubuntu) do not have SDL2_Pango, so Tux Paint 0.9.28
is adversely affected.  Fedora DOES have SDL2_Pango, so works well.
This also allows us to delete a lot of ancient cruft code.

Closes https://sourceforge.net/p/tuxpaint/bugs/268/
h/t Pere

(INSTALL docs to be updated momentarily)
2023-04-30 16:10:29 -07:00
Bill Kendrick
18f9cad6fe Adding "indent.sh" to re-indent code; ran it!!! 2023-04-23 23:26:00 -07:00
Bill Kendrick
0517b4392c Update URL to https://tuxpaint.org/ everywhere
Also, add other social media accounts to list of places to
announce Tux Paint in RELEASE docs.

Also, list a ton more options missing from default example config file
"src/tuxpaint.conf"
2022-12-11 01:29:25 -08:00
dolphin6k
c9193bae2e Removed wrong comment. 2022-12-11 17:36:36 +09:00
dolphin6k
33ef6456bd Returning zero instead of cmp from do_surfcmp() stopped listing all available localized labels on font selector.
In addition, removed Hiragana from translated strings for font scoring.
I have to learn more about this method before doing so.
2022-12-11 10:34:48 +09:00
Bill Kendrick
1f22332415 Use Japanese characters, not "Aa", in font selector when available
Also closes https://sourceforge.net/p/tuxpaint/bugs/266/ by
using code based on Pere's patch.  Thanks to Shin-ichi & Pere!
2022-12-09 22:11:32 -08:00
Mark Kim
3849480fd4 Pango loads Tux Paint-supplied fonts on macOS.
Previously Pango loaded system-supplied fonts instead, which could lead
to fonts not rendering in a human-readable text.  This change fixes
https://sourceforge.net/p/tuxpaint/bugs/265/
2022-12-02 22:57:38 -05:00
Bill Kendrick
9d70b5837c WIP: Cleaned up some compile-time warnings...
...that cropped up in SDL2 branch.
2022-11-14 23:21:45 -08:00
Bill Kendrick
cc05925d9e Re-ran indent on all .c & .h source code files
Like so --
  find . -name "*.c" -or -name "*.h" -exec  indent -nbfda -npcs -npsl -bli0 --no-tabs {} \;

The `indent` invocation differs from the last one noted in
CHANGES.txt (from 2006!?), in that I've added "--no-tabs",
to ensure indents are all space-based.
2022-09-15 00:14:20 -07:00
Mark Kim
ef70ddada6 minor fixes for macOS
Minor fixes from merging the master (SDL1) branch:

- KMOD_META in SDL1 is KMOD_GUI in SDL2. Changed.
- loadfonts() requires additional arguments in the SDL2 branch. Added.
2022-02-19 11:47:12 -05:00
Pere Pujal i Carabantes
b7414433cb Merge branch 'master' into sdl2.0
Catching up with latest devel
Still things to solve/do:
Apply label seems to not work, neither in master
Onscreen keyboard size doesn't perform as in master
Test on other OSs, Windows, Android, ...
2022-02-18 00:29:40 +01:00
Mark Kim
2cc4217a0c macOS check for locale fonts in Tux Paint system preferences location 2022-02-12 22:13:26 -05:00
dolphin6k
be5cbc22ba Fixed abnormal exit of threaded font scan which prevented enabling text/label tools on some environment such as Rocky Linux 8. 2022-01-01 19:51:31 +01:00
dolphin6k
c67dfbc562 Fixed abnormal exit of threaded font scan which prevented enabling text/label tools on some environment such as Rocky Linux 8. 2021-12-22 22:24:53 +09:00
Pere Pujal i Carabantes
35dd1fb4ce Correcting syntax. 2021-12-21 00:31:05 +01:00
Pere Pujal i Carabantes
88d8252952 Merge branch 'master' into sdl2.0 2021-11-08 23:33:49 +01:00
Bill Kendrick
f65fe54a2c Going back to squelching notices re: unusable fonts
Only doing so if DEBUG set.
2021-11-08 13:21:01 -08:00
Pere Pujal i Carabantes
1afe9e155c Merge branch 'master' into sdl2.0
Tons of bugfixes and improvements for Windows by Toyama Shin-Ichi
Angle rotation and some magic tools by Bill.
2021-11-06 08:59:22 +01:00
dolphin6k
7c8f6bca80 Addressed warnings when compiling on MinGW/MSYS
Following warnings still remain so far.

src/tuxpaint.c:199:2: warning: #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR" [-Wcpp]
  199 | #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR"
      |  ^~~~~~~

src/parse.gperf: In function 'parse_one_option':
src/parse.gperf:306:45: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess]
  306 |   memcpy(offset+(char*)tmpcfg, &opt, sizeof(char*)); /* FIXME: This causes a warning; should it be 'sizeof(char)', or do we need to have the warning suppressed? -bjk 2021.10.14 */
      |                                             ^~~~

src/dirwalk.c: In function 'tp_ftw':
src/dirwalk.c:348:2: warning: #warning Failed to see DT_UNKNOWN [-Wcpp]
  348 | #warning Failed to see DT_UNKNOWN
      |  ^~~~~~~

src/get_fname.c: In function 'get_fname':
src/get_fname.c💯3: warning: 'dir' may be used uninitialized in this function [-Wmaybe-uninitialized]
  100 |   snprintf(f, sizeof(f),
      |   ^~~~~~~~~~~~~~~~~~~~~~
  101 |            "%s%c%s",
      |            ~~~~~~~~~
  102 |     dir, (*name) ? '/' : '\0', /* Some mkdir()'s don't like trailing slashes */
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103 |     name);
      |     ~~~~~

magic/src/cartoon.c:178:99: warning: unused parameter 'last' [-Wunused-parameter]
  178 | static void do_cartoon(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
      |                                                                                     ~~~~~~~~~~~~~~^~~~
2021-11-05 12:23:09 +09:00
Bill Kendrick
adc181e3ec More debugging in dirwalk & fonts 2021-10-28 22:52:06 -07:00
Bill Kendrick
d9596af63f Pausing SDL_ttf -> SDL_pango project for now 2021-10-26 23:25:21 -07:00
Bill Kendrick
59920d3ce9 More debug output when TuxPaint_Font_OpenFont ends
Also, avoid unused var. declaration when FORKED_FONTS is disabled.
2021-10-26 23:08:47 -07:00
Bill Kendrick
173b813a04 Hacking on TuxPaint_Font_OpenFont
More DEBUG output.  Looking into having SDL_ttf open a font,
get its name, and then see whether SDL_Pango can load it.
(If not, fall back to SDL_ttf.)

That code is not working, and "#if 0"'d out, for the moment.
2021-10-26 22:49:46 -07:00
Bill Kendrick
8d9ddebcd1 Always echo to stderr if cannot TTF_OpenFont a TTF 2021-10-26 22:17:28 -07:00
Mark Kim
39cc096ece iOS port initial commit
Known Issues
------------
- No printing support.
- No typing support using the OS virtual keyboard.  iOS needs to be signalled
  to bring up the virtual keyboard when the text tool is active.  We also may
  need to do some finagling to make IM work with the virtual keyboard.
- OS language detection doesn't work yet.
- Quitting doesn't close the app.  It just displays a black screen until it is
  force-closed.
- Need to include cross-compilation instructions.

Possible Issues
---------------
- No text display.  This is likely an issue with how pango and related
  libraries were cross-compiled rather than an issue with Tux Paint code.  From
  the error output it appears to be a font rendering issue.
- SVG integration couldn't be tested because RSVG library has not yet be
  cross-compiled successfully.
- Only tested under the iOS Simulator (and not on an actual iOS device yet.)
2021-03-21 23:01:49 -04:00
Mark Kim
92196bd69a iOS port initial commit
Known Issues
------------
- No printing support.
- No typing support using the OS virtual keyboard.  iOS needs to be signalled
  to bring up the virtual keyboard when the text tool is active.  We also may
  need to do some finagling to make IM work with the virtual keyboard.
- OS language detection doesn't work yet.
- Quitting doesn't close the app.  It just displays a black screen until it is
  force-closed.
- Need to include cross-compilation instructions.

Possible Issues
---------------
- No text display.  This is likely an issue with how pango and related
  libraries were cross-compiled rather than an issue with Tux Paint code.  From
  the error output it appears to be a font rendering issue.
- SVG integration couldn't be tested because RSVG library has not yet be
  cross-compiled successfully.
- Only tested under the iOS Simulator (and not on an actual iOS device yet.)
2021-03-21 20:46:03 -04:00
Pere Pujal i Carabantes
7769410b2e Merge 0.9.24 master branch into sdl2.0 2020-05-31 00:47:19 +02:00
Pere Pujal i Carabantes
bcc3bdda96 Closing Tux Paint before the end of font scanning resulted in crashes in the Android port. 2020-05-14 00:48:50 +02:00
Bill Kendrick
91505fae8e Debug output clean-up
Wrapped some debug output in "#ifdef DEBUG" tests,
and made sure some warnings and errors were going to
STDERR, rather than STDOUT.

Motivation: Less noise while launching/using Tux Paint,
unless it matters.
2020-04-02 22:15:13 -07:00
Pere Pujal i Carabantes
a1c778135d Merge branch 'master' into sdl2.0
Merging master 2019-september-24 into sdl2.0 branch
2019-09-24 14:52:40 +02:00
begasus
e5c3cdfcf5 Haiku fixes 2019-09-06 13:45:56 +02:00
Pere Pujal i Carabantes
1a5308226c Merge branch 'master' into sdl2.0 2018-08-30 01:37:00 +02:00
Mark K. Kim
93c1ad5dc3 Fix crash when there are 0 font families.
Running Tux Paint under macOS in Korean mode (and some other languages) causes
it to crash, unless "load system fonts" option is also enabled. Some
investigation showed the issue occurs when num_font_families is 0 in fonts.c.
This change removes the assumption from the code that assumes num_font_families
has at least one record.
2018-06-26 01:28:43 -04:00
Bill Kendrick
9144ebd705 More function documentation 2018-05-17 00:30:48 -07:00
Pere Pujal i Carabantes
f08982ad1f Data like brushes, starters,... now is loaded from assets in the android port, failed to merge some stuff... 2018-01-23 22:00:40 +01:00
Pere Pujal i Carabantes
b2c176730a Merging from the master branch. 2017-12-19 02:47:08 +01:00