SDL_ttf | font files with Simple Directmedia Layer | User Interface library

 by   libsdl-org C Version: release-2.20.2 License: Zlib

kandi X-RAY | SDL_ttf Summary

kandi X-RAY | SDL_ttf Summary

SDL_ttf is a C library typically used in User Interface applications. SDL_ttf has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

This library is a wrapper around the excellent FreeType 2.0 library, available at: This library allows you to use TrueType fonts to render text in SDL applications. To make the library, first install the FreeType library, then type './configure' then 'make' to build the SDL truetype library and the showfont and glfont example applications. Be careful when including fonts with your application, as many of them are copyrighted. The Microsoft fonts, for example, are not freely redistributable and even the free "web" fonts they provide are only redistributable in their special executable installer form (May 1998). There are plenty of freeware and shareware fonts available on the Internet though, and may suit your purposes. This library is under the zlib license, see the file "COPYING.txt" for details. Portions of this software are copyright 2013 The FreeType Project (www.freetype.org). All rights reserved. Enjoy! -Sam Lantinga slouken@libsdl.org (6/20/2001).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              SDL_ttf has a low active ecosystem.
              It has 242 star(s) with 95 fork(s). There are 17 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 21 open issues and 192 have been closed. On average issues are closed in 45 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of SDL_ttf is release-2.20.2

            kandi-Quality Quality

              SDL_ttf has 0 bugs and 0 code smells.

            kandi-Security Security

              SDL_ttf has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              SDL_ttf code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              SDL_ttf is licensed under the Zlib License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              SDL_ttf releases are available to install and integrate.
              It has 62048 lines of code, 120 functions and 94 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SDL_ttf
            Get all kandi verified functions for this library.

            SDL_ttf Key Features

            No Key Features are available at this moment for SDL_ttf.

            SDL_ttf Examples and Code Snippets

            No Code Snippets are available at this moment for SDL_ttf.

            Community Discussions

            QUESTION

            How to link SDL_ttf and SDL_image libraries using cmake in windows?
            Asked 2022-Feb-06 at 20:54

            I have trouble including and linking SDL_ttf and SDL_image to my project. I have a cmake file that works only for SDL and SDL_gfx on Clion. I guess the problem is from the cmake file. I got several errors when I build the project: undefined reference to `FUNCTION'

            The libraries which I used for my project: https://github.com/satayyeb/sdl2-libraries

            sdl2 folder (where library files are located) tree:

            ...

            ANSWER

            Answered 2022-Feb-06 at 20:54

            I found the problem:

            1. In sdl2-image-lib and sdl2-ttf-lib directory there are libSDL2_image.dll.a and libSDL2_ttf.dll.a binary files that must be linked instead of libSDL2_image.a and libSDL2_ttf.a files.

            2. dll files must be copied to the directory where the EXE file is located. the dll files are in bin folders of the library.

            The libraries which I used for my project: https://github.com/satayyeb/sdl2-libraries

            and the modified CMakeLists.txt:

            Source https://stackoverflow.com/questions/70990839

            QUESTION

            SDL_RenderCopy-ing to another texture results in subtly darker image
            Asked 2022-Feb-06 at 06:06

            I've been chasing this visual bug for a while, and I've concluded that the process of renderCopying from one texture to another results in a slightly darkened image.

            ...

            ANSWER

            Answered 2022-Feb-06 at 06:06

            You recursively apply blend operation multiple times on the same data.

            Your render texture have the same size as your window. You didn't clear it, so let's presume it is zeroed by default, including alpha (it may be implementation-dependant, i don't see documentation states that anywyere; explicit clear with required colour may be a good idea).

            SDL_ttf gives you surface with alpha channel. Then you render your first text fragment to that texture with blendmode=blend, blending it atop of zeroes. If you look at the formulas for blend operations - alpha values of your render target gets overwritten by your text texture (dstA = srcA + (dstA * (1-srcA)), and dstA is 0, so it is just srcA), but colour values are multiplied by your source alpha, so srcRGB = srcRGB * srcA.

            Then you blend this target texture on top of your screen, which is cleared to (0, 0, 0, 255), applying the same blend operation again, resulting in another blending by the same srcA, so your colours are now srcRGB = srcRGB * srcA * srcA. This is obviously incorrect.

            It gets worse with your second text fragment, because you do all that again, but never clear your render target. So when you use your render target again, you do another rendering of entire texture, including what was rendered at first text fragment, applying another blend on top of that.

            You need to do blending only once. There are multiple ways to do so, and you'll have to decide what's best for your case. I don't know how you want to use your render texture, so presuming you want to keep alpha values, you need to do blending at last stage. That can be achieved by drawing into render target with blendmode=none, and then blitting your render texture onto screen, but only once. For example:

            Source https://stackoverflow.com/questions/71003071

            QUESTION

            SDL2 Linking errors? Undefined reference to SDL_main
            Asked 2022-Jan-02 at 22:08

            I am trying to figure out how to use SDL2 on VSCODE. I've got basic code and windows working but when I add additional functions and files, it doesn't seem to want to compile. I'm new to this but I thought I included the necessary things in my headers and in my build.

            For the main

            ...

            ANSWER

            Answered 2022-Jan-02 at 22:08

            You can use g++ to build your program in two ways:

            • In two stages, first by compiling the individual .cpp files as translation units to object files .o and then in another invocation of g++ to link them together into an executable

            • Or you can use a single invocation of g++ to compile and link the executable.

            You are currently trying to mix the two modes somehow. For the single-invocation build you should call g++ only once and add all .cpp files to it:

            Source https://stackoverflow.com/questions/70559925

            QUESTION

            Trouble creating a transferable executable with SDL 1.2 and C
            Asked 2021-Dec-14 at 18:25

            I've been having trouble compiling an executable with SDL 1.2 and C that will work on another machine. I'vee been compiling it from Ubuntu using a makefile. I'd like to be able to send a "bin.zip" to a classmate, with "SDL.dll" and "SDL_ttf.dll" inside as well as "prog" the executable that I compiled for them.

            I would expect them to be able to run that "prog" from their own Ubuntu desktop (Virtual Machine, if that's relevant) and not need to install libsdl1.2debian and libsdl-ttf2.0-0 themselves first, since I included the DLLs.

            Note that they can run it fine once they've installed those libraries.

            My project structure, at compilation, is such:

            • 2048-c
              • /bin (dlls and executable)
              • /include (".h" header files)
              • /lib ("SDL.lib", "SDL_ttf.lib", "SDLmain.lib")
              • /src (".c" source files)
              • "makefile"

            My makefile looks like this:

            ...

            ANSWER

            Answered 2021-Dec-14 at 18:23

            Yes, I was missing something obvious : DLLs are specifically for Windows

            Now, as for getting an executable to work without installing the required libraries, I still haven't managed that (linking statically didn't pan out, in my case), but at least I learnt something.

            If I give cross-compilation to Windows a try, I'll try to update this.

            Source https://stackoverflow.com/questions/70350135

            QUESTION

            SDL - Update Surface in C
            Asked 2021-Jul-08 at 14:12

            i use SDL Lib and SDL_TTF Lib

            I have a code that allows you to enter text And then display the text on my window so here the code

            ...

            ANSWER

            Answered 2021-Jul-08 at 14:12

            It's because once you've outputed something to the screen, it stays there unless you clear it or put something above it.

            Think of it as a painter plotting things on his canvas. If you want to overwrite something, you have to overwrite the previous shape.

            The simplest way to deal with this would be to call SDL_RenderClear at the beginning of every draw, it clears the whole screen clean, and then every time you render something it'll never overlap the previous stuff.

            Source https://stackoverflow.com/questions/68303099

            QUESTION

            My SDL_ttf rendered text ends up streched. How do I avoid that?
            Asked 2021-Jul-06 at 03:03

            Here is a minimal example of how I render my SDL text:

            ...

            ANSWER

            Answered 2021-Jul-06 at 03:03

            You are setting your destination rectangle to be different than the text that was rendered to the surface so it will stretch.
            You should also free up the surface before your main loop.
            So the code I think you are looking for:

            Source https://stackoverflow.com/questions/68261748

            QUESTION

            Trying to play a WAV with SDL but getting buzzing noise
            Asked 2021-Jun-30 at 16:15

            I'm writing this simple program to learn how to work with audio with SDL. The program opens a window with a button that says go and when you hit the button it should play a WAV of a drum sample. There are no errors and the program doesn't crash it's just that instead of playing the drum sound it makes a weird buzzing noise that doesn't stop until you exit the program. I think it's something to do with the audio callback function but I am very new to this so I'm not sure exactly how it works.

            ...

            ANSWER

            Answered 2021-Jun-30 at 16:15

            The issue may be that you're using SDL_MixAudio.

            Your code mixes in the data from the .wav file, but mixes it into what?

            What is in stream before calling SDL_MixAudio?

            I get the same buzz, but when I use memset to zero out the stream buffer before calling SDL_MixAudio, I get the correct sound from the .wav file.

            I don't know for sure but I believe that on the second and subsequent calls to your mixing function, the data from the prior callback is still in the stream buffer.

            Side note: When the .wav data has finished playing, we can reset sound.dpos to replay the file again.

            Here's the refactored code:

            Source https://stackoverflow.com/questions/68187766

            QUESTION

            Cmake Can´t find luajit packages of msys2 (windows)
            Asked 2021-Jun-29 at 12:39

            I got another Problem with including libs into my cmake Project. The Project specs are:

            IDE: Visual Studio Code

            Kit: GCC 10.3.0 Mingw64 (via msys2)

            The two packages, Freetype and Luajit, are installed via msys (in mingw64 mode), too.

            So, this is my CMakeLists.txt:

            ...

            ANSWER

            Answered 2021-Jun-29 at 12:39

            I found an Answer for myself. It seems like the Errors appear randomly. After relaunching Vscode 2-3 times, the errors appear or do not appear randomly. Seems like a problem with the IDE 😐

            Source https://stackoverflow.com/questions/68150424

            QUESTION

            How to cleanly do formatted string concatenation in clang++
            Asked 2021-May-19 at 08:54

            I'm using clang++ on Windows to do some very basic SDL2 stuff, but I just found out that Clang++ doesn't come with the , nor "fmt" out of the box.

            What I need is a more pretty way to concatenate a bunch of formatted strings, that would have been trivial elsewhere, and although I managed to get it to work I'm unhappy with the long repeated structures. This is what I got:

            ...

            ANSWER

            Answered 2021-May-17 at 10:46

            Would something like this be acceptable?

            Source https://stackoverflow.com/questions/67559556

            QUESTION

            CMake Fails To Compile "relocation R_X86_64_PC32 against symbol"
            Asked 2021-Mar-27 at 02:36

            I am trying to make a portable framework library that works between Linux and Windows, however whenever I compile my code on Linux I keep running into an error:

            ...

            ANSWER

            Answered 2021-Mar-27 at 02:36

            CMAKE_POSITION_INDEPENDENT_CODE only influences targets defined after it has been set. However, you're setting CMAKE_POSITION_INDEPENDENT_CODE to ON after including the extern subdirectory, which is why the external libraries are not built with position-independent code.

            Source https://stackoverflow.com/questions/66825139

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install SDL_ttf

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/libsdl-org/SDL_ttf.git

          • CLI

            gh repo clone libsdl-org/SDL_ttf

          • sshUrl

            git@github.com:libsdl-org/SDL_ttf.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link