Praise be to Allaah.
Allaah has blessed His slaves by creating for them all kinds of provision on earth, and He has permitted them to eat from that which is halaal (permissible) and good; this includes very many things, it is not limited. Allaah says (interpretation of the meaning):
“O mankind! Eat of that which is lawful and good on the earth, and follow not the footsteps of Shaytaan (Satan). Verily, he is to you an open enemy.” [al-Baqarah 2:168]
Allaah forbids a limited number of foods, as He says (interpretation of the meaning):
“Say (O Muhammad): “I find not in that which has been revealed to me anything forbidden to be eaten by one who wishes to eat it, unless it be Maitah (a dead animal) or blood poured forth (by slaughtering or the like), or the flesh of swine (pork); for that surely, is impure or impious (unlawful) meat (of an animal) which is slaughtered as a sacrifice for others than Allaah (or has been slaughtered for idols, or on which Allaah’s Name has not been mentioned while slaughtering).” [al-An’aam 6:145]
The Prophet (peace and blessings of Allaah be upon him) forbade the eating of every carnivorous animal that has fangs, and every bird which has talons. (Narrated by Muslim, 6/60)
And he forbade the flesh of (domestic) donkeys (narrated by al-Mukhari in al-Fath, no. 4215).
Of the foods which are to be found nowadays, some of them are clearly haraam, such as dead meat [from an animal which has died naturally as opposed to being slaughtered properly] and pork. Some foods may contain ingredients and derivatives which come from haraam sources, so we have to find out where they come from so that we may know what the ruling is concerning them. The gelatin which was mentioned in the question may originate from the skin, muscles and bones of haraam animals such as pigs. Hence gelatin which is derived from collagen which comes from pigs is haraam, because it is as if the pig had been turned into salt. The most correct view is that it is haraam even if it has been changed, so long as it originally came from a pig, which is haraam.
The fats which are used in foods come either from vegetable sources or animal sources.
If they come from vegetable sources they are halaal, so long as they have not been mixed with anything that is impure (najjis) or anything that could contaminate them. If they come from animal sources, they are either from animals that we are permitted to eat or animals that we are not permitted to eat.
If they come from an animal that we are permitted to eat, then they come under the same ruling as the meat of that animal.
If they come from an animal which it is haraam for us to eat – such as pigs – then we look at whether they are used in foods or for other purposes.
If they are usedfor non-food purposes, e.g. many fats are used in making soap, then there is a difference of scholarly opinion, but the most correct view is that they are haraam.
If they are used in foods, e.g., pig fat (lard) is used in making sweets and other foods, this is haraam.
With regard to cheese: if it is made from the milk of an animal which we are not permitted to eat, then according to scholarly consensus it is not permissible to eat it. If it is made from the milk of an animal which we are permitted to eat, and it is known that it is made with rennet that has been derived from an animal slaughtered according to sharee’ah andit has not been mixed with any najaasah (impurity), then it may be eaten.
If it was made with rennet derived from dead meat, there is a difference of scholarly opinion as to whether we may eat it, but the most correct view is that it is haraam.
If it was made with rennet from a source which is inherently naajis (impure), such as rennet derived from pigs, then it should not be eaten.
See Ahkaam al-At’imah fi’l-Sharee’ah al-Islamiyyah by al-Tareeqi, p. 482
In many cases these matters are unclear to the Muslim (he does not know the source of food ingredients). In this case, it is better to fear Allaah and be cautious. Avoiding doubtful things may be preferable to using them in these circumstances, as stated in the hadeeth narrated by al-Nu’maan ibn Basheer (may Allaah be pleased with him) who said: I heard the Messenger of Allaah (peace and blessings of Allaah be upon him) say – and al-Nu’maan pointed to hisears – “That which is lawful is plain and that which is unlawful is plain, and between the two of them there are doubtful matters about which not many people know. Thus he who avoids doubtful matters clears himself in regard to his religion and his honour, but he who falls into doubtful matters falls into that which is unlawful, like the shepherd who pastures around a sanctuary, all but grazing therein. Truly every king has a sanctuary, and truly Allaah’s sanctuary is His prohibitions. Truly in the body there is a morsel of flesh which, if it is sound, all the body issound and which, if it is corrupt, all of it will be corrupt. Truly it is the heart.”
(Narrated by Muslim, 1599).
From the above we learn that the basic principle concerning food is that it is halaal, apart from those things for which there is clear evidence (daleel) that they are haraam, such as dead meat, blood, animals sacrificed to other than Allaah and meat over which the name of Allaah was not pronounced at the time of slaughter. Concerning the foods mentioned in the question: if it is proven that they contain ingredients derived from haraam sources, it is necessary to avoid them, otherwise they need not be avoided. If you are not sure whether they contain anything haraam or not – without being paranoid or succumbing to the waswaas (insinuating whispers of the Shaytaan) – then it is preferable to avoid them as a precaution out of fear of Allaah.
And Allaah knows best.