FIRfilter coefficients can be calculated by taking the inverse Fourier transform of the desired frequency response and throwing away the small values:
 pretend we don't mind lots of filter coefficients
 specify the desired frequency response using lots of samples
 calculate the inverse Fourier transform
 this gives us a lot of filter coefficients
 so truncate the filter coefficients to give us less
 then calculate the Fourier transform of the truncated set of coefficients to see if it still matches our requirement
BUT...
Truncating the filter coefficients means we have a truncated signal. And a truncated signal has a broad frequency spectrum:
So truncating the filter coefficients means the filter's frequency response can only be defined coarsely.
Luckily, we already know a way to sharpen up the frequency spectrum of a truncated signal, by applying a window function. So after truncation, we can apply a window function to sharpen up the filter's frequency response:
So here is an even better recipe for calculating FIR filter coefficients:
 pretend we don't mind lots of filter coefficients
 specify the desired frequency response using lots of samples
 calculate the inverse Fourier transform
 this gives us a lot of filter coefficients
 so truncate the filter coefficients to give us less
 apply a window function to sharpen up the filter's frequency response
 then calculate the Fourier transform of the truncated set of coefficients to see if it still matches our requirement
This is called the window method of FIR filter design.
BUT...
