#!/bin/bash echo "========================================" echo "Text Rendering Diagnostic Script" echo "========================================" echo "" # Check if FreeType is installed echo "1. Checking FreeType installation..." if pkg-config --exists freetype2; then echo " ✓ FreeType found:" pkg-config --modversion freetype2 echo " Library: $(pkg-config --variable=libdir freetype2)/libfreetype.a" echo " Include: $(pkg-config --cflags freetype2)" else echo " ✗ FreeType not found via pkg-config" fi echo "" # Check for font files echo "2. Checking available fonts..." FONTS=( "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf" "/usr/share/fonts/TTF/DejaVuSans.ttf" "/usr/local/share/fonts/DejaVuSans.ttf" ) FOUND_FONT=false for font in "${FONTS[@]}"; do if [ -f "$font" ]; then echo " ✓ Found: $font" FOUND_FONT=true fi done if [ "$FOUND_FONT" = false ]; then echo " ✗ No fonts found in standard locations" echo " Installing DejaVu fonts might help:" echo " sudo apt-get install fonts-dejavu-core" fi echo "" # Check if shaders are compiled echo "3. Checking text shaders..." if [ -f "src/shaders_spirv/text.vert.spv" ]; then echo " ✓ text.vert.spv exists" else echo " ✗ text.vert.spv missing" fi if [ -f "src/shaders_spirv/text.frag.spv" ]; then echo " ✓ text.frag.spv exists" else echo " ✗ text.frag.spv missing" fi if [ -f "src/shaders_spirv/text_vert.inc" ]; then echo " ✓ text_vert.inc exists" else echo " ✗ text_vert.inc missing" fi if [ -f "src/shaders_spirv/text_frag.inc" ]; then echo " ✓ text_frag.inc exists" else echo " ✗ text_frag.inc missing" fi echo "" # Check build configuration echo "4. Checking build configuration..." if [ -f "build/CMakeCache.txt" ]; then if grep -q "ENABLE_FREETYPE" build/CMakeCache.txt 2>/dev/null; then echo " ✓ ENABLE_FREETYPE is defined" else echo " ✗ ENABLE_FREETYPE not found in build" fi if grep -q "FREETYPE_LIBRARY" build/CMakeCache.txt 2>/dev/null; then FREETYPE_LIB=$(grep "FREETYPE_LIBRARY" build/CMakeCache.txt | cut -d= -f2) echo " ✓ FreeType library linked: $FREETYPE_LIB" fi else echo " ⚠ Build directory not found - run ./build.sh first" fi echo "" # Check if executable exists and has FreeType symbols echo "5. Checking executable..." if [ -f "build/bin/ScreenLockDetector" ]; then echo " ✓ Executable exists" # Check for FreeType symbols if nm build/bin/ScreenLockDetector 2>/dev/null | grep -q "FT_Init_FreeType"; then echo " ✓ FreeType symbols found in executable" else echo " ⚠ FreeType symbols not found (might be dynamically linked)" fi # Check for Vulkan symbols if nm build/bin/ScreenLockDetector 2>/dev/null | grep -q "vkCreateGraphicsPipeline"; then echo " ✓ Vulkan symbols found" fi else echo " ✗ Executable not found - build first with ./build.sh" fi echo "" # Run the application with text rendering debug output echo "6. Testing text rendering (5 seconds)..." echo " Starting application..." if [ -f "build/bin/ScreenLockDetector" ]; then timeout 5 ./run.sh 2>&1 | grep -E "Text|text|Font|font|FreeType|pipeline|charMap|Drawing text" | head -20 echo "" echo " If you see 'Drawing text with X vertices' above, text rendering is working!" else echo " ✗ Cannot test - executable not found" fi echo "" # Summary echo "========================================" echo "Summary" echo "========================================" echo "" echo "Text rendering requires:" echo " 1. FreeType library installed ✓" echo " 2. At least one font file available" echo " 3. Text shaders compiled (text.vert/frag.spv)" echo " 4. ENABLE_FREETYPE defined in build" echo " 5. Application successfully initializes text pipeline" echo "" echo "If text is not visible but pipeline is created:" echo " - Check shader coordinate system" echo " - Verify alpha blending is enabled" echo " - Ensure text color contrasts with background" echo " - Check if text is positioned within viewport" echo "" echo "For more details, see: TEXT_RENDERING.md" echo "========================================"