Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8525169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:53:53+00:00 2026-06-11T07:53:53+00:00

I am working on some bitmap fonts. The idea here is that I am

  • 0

I am working on some bitmap fonts. The idea here is that I am given two files (input.txt and font.txt). I have to read a string from input.txt and transform it using the contents of font.txt and then print the corresponding output to another file called output.txt. Each character in font.txt is represented by a grid of 16×8.

I just implement a simple [rogram to transform a single Char A using to bitmap as below. Can someone please help me to reduce the code.
Thank You.

int main()
{
    unsigned int arr[]=
                       {
                        0x00,0x00,0x10,0x38,
                        0x6c,0xc6,0xc6,0xfe,
                        0xc6,0xc6,0xc6,0xc6,
                        0x00,0x00,0x00,0x00
                        };

  int i,k,j;
  int bin[8];
  int c=7;
  for(i=0;i<16;++i)
  {

        bin[0]=arr[i]>>7;
        bin[1]=(arr[i]>>6)&1;
        bin[2]=(arr[i]>>5)&1;
        bin[3]=(arr[i]>>4)&1;
        bin[4]=(arr[i]>>3)&1;
        bin[5]=(arr[i]>>2)&1;
        bin[6]=(arr[i]>>1)&1;
        bin[7]=arr[i]&1;
      k=0;  
      for(j=0;j<4;j++){
      if(bin[k]==0 && bin[k+1]==0)
          {
            printf("..");
          }
          else if(bin[k]==0 && bin[k+1]==0)
          {
            printf(".C");
          }
          else if(bin[k]==0 && bin[k+1]==0)
          {
            printf("C.");

          }
          else
          {
            printf("AA");
      }
k=k+2;      
      }
   printf("\n");

  }
}

OUTPUT:

........
........  
..AA....  
..AAAA..  
AAAAAA..  
AA..AAAA  
AA..AAAA  
AAAAAAAA  
AA..AAAA  
AA..AAAA  
AA..AAAA  
AA..AAAA  
........  
........  
........  
........
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:53:55+00:00Added an answer on June 11, 2026 at 7:53 am

    This produces the same output that you have, but I am ignoring the logic for “.C” and “C.” since your codes does as well. 😉

    #include <stdio.h>
    int main() {
        unsigned int arr[]=
                           {
                            0x00,0x00,0x10,0x38,
                            0x6c,0xc6,0xc6,0xfe,
                            0xc6,0xc6,0xc6,0xc6,
                            0x00,0x00,0x00,0x00
                            };
    
      int i,j;
      for(i=0;i<16;++i) {
        unsigned char letter = arr[i];
        for(j =0; j < 7; j++) {
            const char *str = "..";
            if(letter & 0x80) str = "AA";
            fputs(str,stdout);
            letter <<= 1;
        }
        putchar('\n');
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am Working on some bitmap fonts. The idea here is that i am
I have some working code that uses IImgCtx to load images, but I can't
I seem to have a sepia tone that is almost working properly. For some
I'm working on some image transformations using ASP.NET/C#/GDI+. I have a method that looks
I'm working some code that inserts csv rows into an SQLite database using Python.
Working on some tweaks for a build script, I noticed that the output from
I have some working code with a crutch to add BOM marker to a
When working on some Javascript for a web application, I noticed that I had
I am working with delphi. I have TImage, to which I assign a bitmap.
I have a set of classes that represent the storage of a font format

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.